Script and Install

This commit is contained in:
Michael RICOIS 2012-12-19 14:07:00 +00:00
parent 1d827af35a
commit 7b2eb49921
27 changed files with 42938 additions and 868 deletions

View File

@ -1,155 +0,0 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Loader
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* Generate class maps for use with autoloading.
*
* Usage:
* --help|-h Get usage message
* --library|-l [ <string> ] Library to parse; if none provided, assumes
* current directory
* --output|-o [ <string> ] Where to write autoload file; if not provided,
* assumes "autoload_classmap.php" in library directory
* --overwrite|-w Whether or not to overwrite existing autoload
* file
*/
$libPath = dirname(__FILE__) . '/../library';
if (!is_dir($libPath)) {
// Try to load StandardAutoloader from include_path
if (false === include('Zend/Loader/StandardAutoloader.php')) {
echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
exit(2);
}
} else {
// Try to load StandardAutoloader from library
if (false === include(dirname(__FILE__) . '/../library/Zend/Loader/StandardAutoloader.php')) {
echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
exit(2);
}
}
// Setup autoloading
$loader = new Zend_Loader_StandardAutoloader();
$loader->setFallbackAutoloader(true);
$loader->register();
$rules = array(
'help|h' => 'Get usage message',
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory',
'overwrite|w' => 'Whether or not to overwrite existing autoload file',
);
try {
$opts = new Zend_Console_Getopt($rules);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit(2);
}
if ($opts->getOption('h')) {
echo $opts->getUsageMessage();
exit();
}
$path = $libPath;
if (array_key_exists('PWD', $_SERVER)) {
$path = $_SERVER['PWD'];
}
if (isset($opts->l)) {
$path = $opts->l;
if (!is_dir($path)) {
echo "Invalid library directory provided" . PHP_EOL . PHP_EOL;
echo $opts->getUsageMessage();
exit(2);
}
$path = realpath($path);
}
$usingStdout = false;
$output = $path . DIRECTORY_SEPARATOR . 'autoload_classmap.php';
if (isset($opts->o)) {
$output = $opts->o;
if ('-' == $output) {
$output = STDOUT;
$usingStdout = true;
} elseif (!is_writeable(dirname($output))) {
echo "Cannot write to '$output'; aborting." . PHP_EOL
. PHP_EOL
. $opts->getUsageMessage();
exit(2);
} elseif (file_exists($output)) {
if (!$opts->getOption('w')) {
echo "Autoload file already exists at '$output'," . PHP_EOL
. "but 'overwrite' flag was not specified; aborting." . PHP_EOL
. PHP_EOL
. $opts->getUsageMessage();
exit(2);
}
}
}
$strip = $path;
if (!$usingStdout) {
echo "Creating class file map for library in '$path'..." . PHP_EOL;
}
// Get the ClassFileLocator, and pass it the library path
$l = new Zend_File_ClassFileLocator($path);
// Iterate over each element in the path, and create a map of
// classname => filename, where the filename is relative to the library path
$map = new stdClass;
$strip .= DIRECTORY_SEPARATOR;
function createMap(Iterator $i, $map, $strip) {
$file = $i->current();
$namespace = empty($file->namespace) ? '' : $file->namespace . '\\';
$filename = str_replace($strip, '', $file->getRealpath());
// Windows portability
$filename = str_replace(array('/', '\\'), "' . DIRECTORY_SEPARATOR . '", $filename);
$map->{$namespace . $file->classname} = $filename;
return true;
}
iterator_apply($l, 'createMap', array($l, $map, $strip));
// Create a file with the class/file map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
$dirStore = 'dirname_' . uniqid();
$content = '<' . "?php\n"
. '$' . $dirStore . " = dirname(__FILE__);\n"
. 'return ' . var_export((array) $map, true) . ';';
// Prefix with dirname(__FILE__); modify the generated content
$content = preg_replace('#(=> )#', '$1$' . $dirStore . ' . DIRECTORY_SEPARATOR . ', $content);
$content = str_replace("\\'", "'", $content);
// Write the contents to disk
file_put_contents($output, $content);
if (!$usingStdout) {
echo "Wrote classmap file to '" . realpath($output) . "'" . PHP_EOL;
}

View File

@ -1,44 +0,0 @@
@ECHO off
REM Zend Framework
REM
REM LICENSE
REM
REM This source file is subject to the new BSD license that is bundled
REM with this package in the file LICENSE.txt.
REM It is also available through the world-wide-web at this URL:
REM http://framework.zend.com/license/new-bsd
REM If you did not receive a copy of the license and are unable to
REM obtain it through the world-wide-web, please send an email
REM to license@zend.com so we can send you a copy immediately.
REM
REM Zend
REM Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
REM http://framework.zend.com/license/new-bsd New BSD License
REM Test to see if this was installed via pear
SET ZTMPZTMPZTMPZ=@ph
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@
REM below @php_bin@
FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED)
GOTO PEAR_INSTALLED
:NON_PEAR_INSTALLED
REM Assume php.exe is executable, and that zf.php will reside in the
REM same file as this one
SET PHP_BIN=php.exe
SET PHP_DIR=%~dp0
GOTO RUN
:PEAR_INSTALLED
REM Assume this was installed via PEAR and use replacements php_bin & php_dir
SET PHP_BIN=@php_bin@
SET PHP_DIR=@php_dir@
GOTO RUN
:RUN
SET ZF_SCRIPT=%PHP_DIR%\zf.php
"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %*

View File

@ -1,624 +0,0 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Tool
* @subpackage Framework
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* ZF
*
* @category Zend
* @package Zend_Tool
* @subpackage Framework
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ZF
{
/**
* @var bool
*/
protected $_clientLoaded = false;
/**
* @var string
*/
protected $_mode = 'runTool';
/**
* @var array of messages
*/
protected $_messages = array();
/**
* @var string
*/
protected $_homeDirectory = null;
/**
* @var string
*/
protected $_storageDirectory = null;
/**
* @var string
*/
protected $_configFile = null;
/**
* main()
*
* @return void
*/
public static function main()
{
$zf = new self();
$zf->bootstrap();
$zf->run();
}
/**
* bootstrap()
*
* @return ZF
*/
public function bootstrap()
{
// detect settings
$this->_mode = $this->_detectMode();
$this->_homeDirectory = $this->_detectHomeDirectory();
$this->_storageDirectory = $this->_detectStorageDirectory();
$this->_configFile = $this->_detectConfigFile();
// setup
$this->_setupPHPRuntime();
$this->_setupToolRuntime();
}
/**
* run()
*
* @return ZF
*/
public function run()
{
switch ($this->_mode) {
case 'runError':
$this->_runError();
$this->_runInfo();
break;
case 'runSetup':
if ($this->_runSetup() === false) {
$this->_runInfo();
}
break;
case 'runInfo':
$this->_runInfo();
break;
case 'runTool':
default:
$this->_runTool();
break;
}
return $this;
}
/**
* _detectMode()
*
* @return ZF
*/
protected function _detectMode()
{
$arguments = $_SERVER['argv'];
$mode = 'runTool';
if (!isset($arguments[0])) {
return $mode;
}
if ($arguments[0] == $_SERVER['PHP_SELF']) {
$this->_executable = array_shift($arguments);
}
if (!isset($arguments[0])) {
return $mode;
}
if ($arguments[0] == '--setup') {
$mode = 'runSetup';
} elseif ($arguments[0] == '--info') {
$mode = 'runInfo';
}
return $mode;
}
/**
* _detectHomeDirectory() - detect the home directory in a variety of different places
*
* @param bool $mustExist Should the returned value already exist in the file system
* @param bool $returnMessages Should it log messages for output later
* @return string
*/
protected function _detectHomeDirectory($mustExist = true, $returnMessages = true)
{
$homeDirectory = null;
$homeDirectory = getenv('ZF_HOME'); // check env var ZF_HOME
if ($homeDirectory) {
$this->_logMessage('Home directory found in environment variable ZF_HOME with value ' . $homeDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
return $homeDirectory;
} else {
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
}
}
$homeDirectory = getenv('HOME'); // HOME environment variable
if ($homeDirectory) {
$this->_logMessage('Home directory found in environment variable HOME with value ' . $homeDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
return $homeDirectory;
} else {
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
}
}
$homeDirectory = getenv('HOMEPATH');
if ($homeDirectory) {
$this->_logMessage('Home directory found in environment variable HOMEPATH with value ' . $homeDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
return $homeDirectory;
} else {
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
}
}
$homeDirectory = getenv('USERPROFILE');
if ($homeDirectory) {
$this->_logMessage('Home directory found in environment variable USERPROFILE with value ' . $homeDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
return $homeDirectory;
} else {
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
}
}
return false;
}
/**
* _detectStorageDirectory() - Detect where the storage directory is from a variaty of possiblities
*
* @param bool $mustExist Should the returned value already exist in the file system
* @param bool $returnMessages Should it log messages for output later
* @return string
*/
protected function _detectStorageDirectory($mustExist = true, $returnMessages = true)
{
$storageDirectory = false;
$storageDirectory = getenv('ZF_STORAGE_DIR');
if ($storageDirectory) {
$this->_logMessage('Storage directory path found in environment variable ZF_STORAGE_DIR with value ' . $storageDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
return $storageDirectory;
} else {
$this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
}
}
$homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
if ($homeDirectory) {
$storageDirectory = $homeDirectory . '/.zf/';
$this->_logMessage('Storage directory assumed in home directory at location ' . $storageDirectory, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
return $storageDirectory;
} else {
$this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
}
}
return false;
}
/**
* _detectConfigFile() - Detect config file location from a variety of possibilities
*
* @param bool $mustExist Should the returned value already exist in the file system
* @param bool $returnMessages Should it log messages for output later
* @return string
*/
protected function _detectConfigFile($mustExist = true, $returnMessages = true)
{
$configFile = null;
$configFile = getenv('ZF_CONFIG_FILE');
if ($configFile) {
$this->_logMessage('Config file found environment variable ZF_CONFIG_FILE at ' . $configFile, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($configFile))) {
return $configFile;
} else {
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
}
}
$homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
if ($homeDirectory) {
$configFile = $homeDirectory . '/.zf.ini';
$this->_logMessage('Config file assumed in home directory at location ' . $configFile, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($configFile))) {
return $configFile;
} else {
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
}
}
$storageDirectory = ($this->_storageDirectory) ? $this->_storageDirectory : $this->_detectStorageDirectory(true, false);
if ($storageDirectory) {
$configFile = $storageDirectory . '/zf.ini';
$this->_logMessage('Config file assumed in storage directory at location ' . $configFile, $returnMessages);
if (!$mustExist || ($mustExist && file_exists($configFile))) {
return $configFile;
} else {
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
}
}
return false;
}
/**
* _setupPHPRuntime() - parse the config file if it exists for php ini values to set
*
* @return void
*/
protected function _setupPHPRuntime()
{
// set php runtime settings
ini_set('display_errors', true);
// support the changing of the current working directory, necessary for some providers
$cwd = getenv('ZEND_TOOL_CURRENT_WORKING_DIRECTORY');
if ($cwd != '' && realpath($cwd)) {
chdir($cwd);
}
if (!$this->_configFile) {
return;
}
$zfINISettings = parse_ini_file($this->_configFile);
$phpINISettings = ini_get_all();
foreach ($zfINISettings as $zfINIKey => $zfINIValue) {
if (substr($zfINIKey, 0, 4) === 'php.') {
$phpINIKey = substr($zfINIKey, 4);
if (array_key_exists($phpINIKey, $phpINISettings)) {
ini_set($phpINIKey, $zfINIValue);
}
}
}
}
/**
* _setupToolRuntime() - setup the tools include_path and load the proper framwork parts that
* enable Zend_Tool to work.
*
* @return void
*/
protected function _setupToolRuntime()
{
$includePathPrepend = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND');
$includePathFull = getenv('ZEND_TOOL_INCLUDE_PATH');
// check if the user has not provided anything
if (!($includePathPrepend || $includePathFull)) {
if ($this->_tryClientLoad()) {
return;
}
}
// if ZF is not in the include_path, but relative to this file, put it in the include_path
if ($includePathPrepend || $includePathFull) {
if (isset($includePathPrepend) && ($includePathPrepend !== false)) {
set_include_path($includePathPrepend . PATH_SEPARATOR . get_include_path());
} elseif (isset($includePathFull) && ($includePathFull !== false)) {
set_include_path($includePathFull);
}
}
if ($this->_tryClientLoad()) {
return;
}
$zfIncludePath['relativePath'] = dirname(__FILE__) . '/../library/';
if (file_exists($zfIncludePath['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) {
set_include_path(realpath($zfIncludePath['relativePath']) . PATH_SEPARATOR . get_include_path());
}
if (!$this->_tryClientLoad()) {
$this->_mode = 'runError';
return;
}
}
/**
* _tryClientLoad() - Attempt to load the Zend_Tool_Framework_Client_Console to enable the tool to run.
*
* This method will return false if its not loaded to allow the consumer to alter the environment in such
* a way that it can be called again to try loading the proper file/class.
*
* @return bool if the client is actuall loaded or not
*/
protected function _tryClientLoad()
{
$this->_clientLoaded = false;
$fh = @fopen('Zend/Tool/Framework/Client/Console.php', 'r', true);
if (!$fh) {
return $this->_clientLoaded; // false
} else {
fclose($fh);
unset($fh);
include 'Zend/Tool/Framework/Client/Console.php';
$this->_clientLoaded = class_exists('Zend_Tool_Framework_Client_Console');
}
return $this->_clientLoaded;
}
/**
* _runError() - Output the error screen that tells the user that the tool was not setup
* in a sane way
*
* @return void
*/
protected function _runError()
{
echo <<<EOS
***************************** ZF ERROR ********************************
In order to run the zf command, you need to ensure that Zend Framework
is inside your include_path. There are a variety of ways that you can
ensure that this zf command line tool knows where the Zend Framework
library is on your system, but not all of them can be described here.
The easiest way to get the zf command running is to give it the include
path via an environment variable ZEND_TOOL_INCLUDE_PATH or
ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
then run the command "zf --setup". This command is designed to create
a storage location for your user, as well as create the zf.ini file
that the zf command will consult in order to run properly on your
system.
Example you would run:
$ ZEND_TOOL_INCLUDE_PATH=/path/to/library zf --setup
Your are encourged to read more in the link that follows.
EOS;
}
/**
* _runInfo() - this command will produce information about the setup of this script and
* Zend_Tool
*
* @return void
*/
protected function _runInfo()
{
echo 'Zend_Tool & CLI Setup Information' . PHP_EOL
. '(available via the command line "zf --info")'
. PHP_EOL;
echo ' * ' . implode(PHP_EOL . ' * ', $this->_messages) . PHP_EOL;
echo PHP_EOL;
echo 'To change the setup of this tool, run: "zf --setup"';
echo PHP_EOL;
}
/**
* _runSetup() - parse the request to see which setup command to run
*
* @return void
*/
protected function _runSetup()
{
$setupCommand = (isset($_SERVER['argv'][2])) ? $_SERVER['argv'][2] : null;
switch ($setupCommand) {
case 'storage-directory':
$this->_runSetupStorageDirectory();
break;
case 'config-file':
$this->_runSetupConfigFile();
break;
default:
$this->_runSetupMoreInfo();
break;
}
}
/**
* _runSetupStorageDirectory() - if the storage directory does not exist, create it
*
* @return void
*/
protected function _runSetupStorageDirectory()
{
$storageDirectory = $this->_detectStorageDirectory(false, false);
if (file_exists($storageDirectory)) {
echo 'Directory already exists at ' . $storageDirectory . PHP_EOL
. 'Cannot create storage directory.';
return;
}
mkdir($storageDirectory);
echo 'Storage directory created at ' . $storageDirectory . PHP_EOL;
}
/**
* _runSetupConfigFile()
*
* @return void
*/
protected function _runSetupConfigFile()
{
$configFile = $this->_detectConfigFile(false, false);
if (file_exists($configFile)) {
echo 'File already exists at ' . $configFile . PHP_EOL
. 'Cannot write new config file.';
return;
}
$includePath = get_include_path();
$contents = 'php.include_path = "' . $includePath . '"';
file_put_contents($configFile, $contents);
$iniValues = ini_get_all();
if ($iniValues['include_path']['global_value'] != $iniValues['include_path']['local_value']) {
echo 'NOTE: the php include_path to be used with the tool has been written' . PHP_EOL
. 'to the config file, using ZEND_TOOL_INCLUDE_PATH (or other include_path setters)' . PHP_EOL
. 'is no longer necessary.' . PHP_EOL . PHP_EOL;
}
echo 'Config file written to ' . $configFile . PHP_EOL;
}
/**
* _runSetupMoreInfo() - return more information about what can be setup, and what is setup
*
* @return void
*/
protected function _runSetupMoreInfo()
{
$homeDirectory = $this->_detectHomeDirectory(false, false);
$storageDirectory = $this->_detectStorageDirectory(false, false);
$configFile = $this->_detectConfigFile(false, false);
echo <<<EOS
ZF Command Line Tool - Setup
----------------------------
Current Paths (Existing or not):
Home Directory: {$homeDirectory}
Storage Directory: {$storageDirectory}
Config File: {$configFile}
Important Environment Variables:
ZF_HOME
- the directory this tool will look for a home directory
- directory must exist
ZF_STORAGE_DIR
- where this tool will look for a storage directory
- directory must exist
ZF_CONFIG_FILE
- where this tool will look for a configuration file
ZF_TOOL_INCLUDE_PATH
- set the include_path for this tool to use this value
ZF_TOOL_INCLUDE_PATH_PREPEND
- prepend the current php.ini include_path with this value
Search Order:
Home Directory:
- ZF_HOME, then HOME (*nix), then HOMEPATH (windows)
Storage Directory:
- ZF_STORAGE_DIR, then {home}/.zf/
Config File:
- ZF_CONFIG_FILE, then {home}/.zf.ini, then {home}/zf.ini,
then {storage}/zf.ini
Commands:
zf --setup storage-directory
- setup the storage directory, directory will be created
zf --setup config-file
- create the config file with some default values
EOS;
}
/**
* _runTool() - This is where the magic happens, dispatch Zend_Tool
*
* @return void
*/
protected function _runTool()
{
$configOptions = array();
if (isset($this->_configFile) && $this->_configFile) {
$configOptions['configOptions']['configFilepath'] = $this->_configFile;
}
if (isset($this->_storageDirectory) && $this->_storageDirectory) {
$configOptions['storageOptions']['directory'] = $this->_storageDirectory;
}
// ensure that zf.php loads the Zend_Tool_Project features
$configOptions['classesToLoad'] = 'Zend_Tool_Project_Provider_Manifest';
$console = new Zend_Tool_Framework_Client_Console($configOptions);
$console->dispatch();
}
/**
* _logMessage() - Internal method used to log setup and information messages.
*
* @param string $message
* @param bool $storeMessage
* @return void
*/
protected function _logMessage($message, $storeMessage = true)
{
if (!$storeMessage) {
return;
}
$this->_messages[] = $message;
}
}
if (!getenv('ZF_NO_MAIN')) {
ZF::main();
}

View File

@ -1,45 +0,0 @@
#!/bin/sh
#############################################################################
# Zend Framework
#
# LICENSE
#
# This source file is subject to the new BSD license that is bundled
# with this package in the file LICENSE.txt.
# It is also available through the world-wide-web at this URL:
# http://framework.zend.com/license/new-bsd
# If you did not receive a copy of the license and are unable to
# obtain it through the world-wide-web, please send an email
# to license@zend.com so we can send you a copy immediately.
#
# Zend
# Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
# http://framework.zend.com/license/new-bsd New BSD License
#############################################################################
# find php: pear first, command -v second, straight up php lastly
if test "@php_bin@" != '@'php_bin'@'; then
PHP_BIN="@php_bin@"
elif command -v php 1>/dev/null 2>/dev/null; then
PHP_BIN=`command -v php`
else
PHP_BIN=php
fi
# find zf.php: pear first, same directory 2nd,
if test "@php_dir@" != '@'php_dir'@'; then
PHP_DIR="@php_dir@"
else
SELF_LINK="$0"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
while test -n "$SELF_LINK_TMP"; do
SELF_LINK="$SELF_LINK_TMP"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
done
PHP_DIR="$(dirname "$SELF_LINK")"
fi
"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@"

View File

@ -0,0 +1,58 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.session.save_path = APPLICATION_PATH "/../data/sessions"
resources.session.gc_maxlifetime = 86400
resources.session.cookie_lifetime = 86400
resources.session.remember_me_seconds = 86400
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.frontController.params.displayExceptions = 0
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"
autoloaderNamespaces[] = "Application_"
autoloaderNamespaces[] = "Scores_"
autoloaderNamespaces[] = "Form_"
; Scores configuration
profil.server.name = Odea
profil.webservice.location = celeste
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=ciblage
profil.db.ciblage.params.password=z7jq8AhvrwqQJ4Yb
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.3.30
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=127.0.0.1
profil.sphinx.port=3312
[staging : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

View File

@ -0,0 +1,37 @@
[server]
name = Odea
[webservice]
location = celeste
[databases]
db.adapter=mysqli
db.params.host=127.0.0.1
db.params.username=ciblage
db.params.password=z7jq8AhvrwqQJ4Yb
db.params.dbname=ciblage
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
jo.adapter=mysqli
jo.params.host=192.168.3.30
jo.params.username=ciblage
jo.params.password=z7jq8AhvrwqQJ4Yb
jo.params.dbname=jo
jo.params.persistent = true
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[sphinx]
host = 127.0.0.1
port = 3312
[mail]
method = smtp
smpt_port =
smtp_host = smtp.celeste.fr
support = supportdev@scores-decisions.com
supportdev = supportdev@scores-decisions.com
contact = supportdev@scores-decisions.com
production = supportdev@scores-decisions.com
[path]
data = "/home/vhosts/data"

View File

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS `ciblage_comptages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idDefinition` int(11) NOT NULL,
`resultat` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL,
`dateAjout` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Résultat des comptages';

View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `ciblage_criteres` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idClient` int(11) NOT NULL,
`login` varchar(20) NOT NULL,
`reference` varchar(50) NOT NULL,
`criteres` longtext NOT NULL,
`parent` int(11) NOT NULL,
`dateAjout` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `reference` (`reference`),
KEY `login` (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Sauvegarde des critères pour les comptages' ;

View File

@ -0,0 +1,18 @@
CREATE TABLE `customer_params` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idClient` int(11) NOT NULL,
`service` varchar(100) NOT NULL,
`filterRNCS` tinyint(1) NOT NULL COMMENT 'Filtrer sur le perimetre RNCS ',
`licenceINSEE` tinyint(1) NOT NULL COMMENT 'Le client possède une licence INSEE',
`immediatExtract` int(11) NOT NULL DEFAULT '0' COMMENT 'Nombre de ligne maximum pour une extraction immédiate',
`dateContrat` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date de debut du contrat',
`periodContrat` int(2) NOT NULL COMMENT 'Durée du contrat en mois',
`periodPaiement` int(2) NOT NULL COMMENT 'Durée en mois pour l''emission de la facture (1,3,6,12)',
`priceLine` float NOT NULL DEFAULT '0',
`forfait` int(11) NOT NULL DEFAULT '0' COMMENT 'Montant du forfait pour décompte',
`limitLines` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter à un nombre de ligne sur la période du contrat',
`limitFiles` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter à un nombre de fichier sur la durée du contrat',
`criteres` text NOT NULL,
`dateAdded` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Paramètres de facturation';

View File

@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS `customer_prefs` (
`login` varchar(255) NOT NULL,
`json` text NOT NULL,
PRIMARY KEY (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS `enrichissement_fichiers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idProfil` int(11) NOT NULL,
`reference` varchar(50) NOT NULL,
`identifiants` longtext NOT NULL,
`nbLigneTotales` int(11) NOT NULL,
`nbLigneTraites` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL DEFAULT '0',
`error` varchar(100) NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`fichierIn` varchar(100) NOT NULL,
`fichierOut` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS `enrichissement_identifiants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idComptage` int(11) NOT NULL,
`idCriteres` int(11) NOT NULL DEFAULT '0',
`idProfil` int(11) NOT NULL,
`reference` varchar(50) NOT NULL,
`identifiants` longtext NOT NULL,
`nbLigneTotales` int(11) NOT NULL,
`nbLigneTraites` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL DEFAULT '0',
`error` varchar(100) NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`fichier` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,14 @@
CREATE TABLE `enrichissement_profils` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idClient` int(11) NOT NULL,
`service` varchar(25) NOT NULL,
`login` varchar(50) NOT NULL,
`reference` varchar(50) NOT NULL,
`criteres` text NOT NULL,
`dataInsee` tinyint(4) NOT NULL,
`dateAjout` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateSuppr` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`actif` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
KEY `idClient` (`idClient`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Profil d''extraction';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
--
-- Structure de la table `departements`
--
CREATE TABLE IF NOT EXISTS `fields_departements` (
`numdep` char(3) NOT NULL DEFAULT '0',
`libdep` varchar(30) NOT NULL DEFAULT '',
`numreg` tinyint(4) NOT NULL DEFAULT '0',
`codeRegionInsee` tinyint(2) NOT NULL DEFAULT '0',
PRIMARY KEY (`numdep`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Contenu de la table `departements`
--
INSERT INTO `fields_departements` (`numdep`, `libdep`, `numreg`, `codeRegionInsee`) VALUES
('03', 'Allier', 3, 83),
('04', 'Alpes-de-Haute-Provence', 21, 93),
('02', 'Aisne', 19, 26),
('01', 'Ain', 22, 82),
('05', 'Hautes-Alpes', 21, 93),
('06', 'Alpes-Maritimes', 21, 93),
('07', 'Ardèche', 22, 82),
('08', 'Ardennes', 7, 21),
('09', 'Ariège', 15, 73),
('10', 'Aube', 7, 21),
('11', 'Aude', 11, 91),
('12', 'Aveyron', 15, 73),
('13', 'Bouches-du-Rhône', 21, 93),
('14', 'Calvados', 18, 25),
('15', 'Cantal', 3, 83),
('16', 'Charente', 20, 54),
('17', 'Charente-Maritime', 20, 54),
('18', 'Cher', 6, 24),
('19', 'Corrèze', 12, 74),
('2A', 'Corse-du-Sud', 8, 94),
('20', 'Corse', 8, 94),
('21', 'Côte-d''Or', 4, 26),
('22', 'Côtes-d''Armor', 5, 53),
('23', 'Creuse', 12, 74),
('24', 'Dordogne', 2, 72),
('25', 'Doubs', 9, 43),
('26', 'Drôme', 22, 82),
('27', 'Eure', 17, 23),
('28', 'Eure-et-Loir', 6, 24),
('29', 'Finistère', 5, 53),
('30', 'Gard', 11, 91),
('33', 'Gironde', 2, 72),
('32', 'Gers', 15, 73),
('34', 'Hérault', 11, 91),
('31', 'Haute-Garonne', 15, 73),
('36', 'Indre', 6, 24),
('37', 'Indre-et-Loire', 6, 24),
('35', 'Ille-et-Vilaine', 5, 53),
('39', 'Jura', 9, 43),
('38', 'Isère', 22, 82),
('40', 'Landes', 2, 72),
('41', 'Loir-et-Cher', 6, 24),
('42', 'Loire', 22, 82),
('43', 'Haute-Loire', 3, 83),
('44', 'Loire-Atlantique', 13, 52),
('45', 'Loiret', 6, 24),
('46', 'Lot', 15, 73),
('47', 'Lot-et-Garonne', 2, 72),
('48', 'Lozère', 11, 91),
('49', 'Maine-et-Loire', 13, 52),
('53', 'Mayenne', 13, 52),
('51', 'Marne', 7, 21),
('50', 'Manche', 18, 25),
('52', 'Haute-Marne', 7, 21),
('54', 'Meurthe-et-Moselle', 14, 41),
('56', 'Morbihan', 5, 53),
('55', 'Meuse', 14, 41),
('57', 'Moselle', 14, 41),
('58', 'Nièvre', 4, 26),
('59', 'Nord', 16, 31),
('60', 'Oise', 19, 26),
('62', 'Pas-de-Calais', 16, 31),
('61', 'Orne', 18, 25),
('63', 'Puy-de-Dôme', 3, 83),
('67', 'Bas-Rhin', 1, 42),
('68', 'Haut-Rhin', 1, 42),
('69', 'Rhône', 22, 82),
('64', 'Pyrénées-Atlantiques', 2, 72),
('65', 'Hautes-Pyrénées', 15, 73),
('66', 'Pyrénées-Orientales', 11, 91),
('70', 'Haute-Saône', 9, 43),
('71', 'Saône-et-Loire', 4, 26),
('72', 'Sarthe', 13, 52),
('73', 'Savoie', 22, 82),
('74', 'Haute-Savoie', 22, 82),
('75', 'Paris', 10, 11),
('76', 'Seine-Maritime', 17, 23),
('77', 'Seine-et-Marne', 10, 11),
('78', 'Yvelines', 10, 11),
('79', 'Deux-Sèvres', 20, 54),
('80', 'Somme', 19, 26),
('81', 'Tarn', 15, 73),
('82', 'Tarn-et-Garonne', 15, 73),
('83', 'Var', 21, 93),
('84', 'Vaucluse', 21, 93),
('85', 'Vendée', 13, 52),
('86', 'Vienne', 20, 54),
('87', 'Haute-Vienne', 12, 74),
('88', 'Vosges', 14, 41),
('89', 'Yonne', 4, 26),
('90', 'Territoire de Belfort', 9, 43),
('91', 'Essonne', 10, 11),
('92', 'Hauts-de-Seine', 10, 11),
('93', 'Seine-Saint-Denis', 10, 11),
('94', 'Val-de-Marne', 10, 11),
('95', 'Val-d''Oise', 10, 11),
('971', 'Guadeloupe', 23, 1),
('972', 'Martinique', 23, 2),
('973', 'Guyane', 23, 3),
('974', 'Réunion', 24, 4),
('200', 'Corse-du-Sud', 8, 94),
('201', 'Corse-du-Sud', 8, 94),
('202', 'Haute-Corse', 8, 94),
('976', 'Mayotte', 0, 0),
('988', 'Nouvelle-Calédonie', 0, 0),
('987', 'Polynésie-Française', 0, 0),
('975', 'Saint-Pierre-et-Miquelon', 0, 0),
('986', 'Wallis-et-Futuna', 0, 0),
('2B', 'Haute-Corse', 8, 94);

View File

@ -0,0 +1,338 @@
--
-- Structure de la table `fields_formejuridique`
--
CREATE TABLE IF NOT EXISTS `fields_formejuridique` (
`fjCode` int(4) NOT NULL,
`fjLibelle` varchar(100) NOT NULL,
`fjInsee` tinyint(1) NOT NULL,
KEY `fjCode` (`fjCode`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Contenu de la table `formejuridique`
--
INSERT INTO `fields_formejuridique` (`fjCode`, `fjLibelle`, `fjInsee`) VALUES
(0, 'Indéterminée', 0),
(1, 'Personne physique', 1),
(2, 'Groupement de droit privé non doté de la personnalité morale', 1),
(3, 'Personne morale de droit étranger', 1),
(4, 'Personne morale de droit public soumise au droit commercial', 1),
(5, 'Société commerciale', 1),
(6, 'Autre personne morale immatriculée au RCS', 1),
(7, 'Personne morale et organisme soumis au droit administratif', 1),
(8, 'Organisme privé spécialisé', 1),
(9, 'Groupement de droit privé', 1),
(11, 'Artisan Commerçant', 1),
(12, 'Commerçant', 1),
(13, 'Artisan', 1),
(14, 'Officier public ou ministériel', 1),
(15, 'Profession libérale', 1),
(16, 'Exploitant agricole', 1),
(17, 'Agent commercial', 1),
(18, 'Associé Gérant de société', 1),
(19, '(Autre) personne physique', 1),
(21, 'Indivision', 1),
(22, 'Société créée de fait', 1),
(23, 'Société en participation', 1),
(27, 'Paroisse hors zone concordataire', 1),
(29, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
(31, 'Personne morale de droit étranger, immatriculée au RCS (registre du commerce et des sociétés)', 1),
(32, 'Personne morale de droit étranger, non immatriculée au RCS', 1),
(41, 'Établissement public ou régie à caractère industriel ou commercial', 1),
(51, 'Société coopérative commerciale particulière', 1),
(52, 'Société en nom collectif', 1),
(53, 'Société en commandite', 1),
(54, 'Société à responsabilité limité', 1),
(55, 'Société anonyme à conseil d''administration', 1),
(56, 'Société anonyme à directoire', 1),
(57, 'Société par actions simplifiée', 1),
(61, 'Caisse d''épargne et de prévoyance', 1),
(62, 'Groupement d''intérêt économique', 1),
(63, 'Société coopérative agricole', 1),
(64, 'Société d''assurance mutuelle', 1),
(65, 'Société civile', 1),
(69, 'Autre personne morale de droit privé inscrite au registre du commerce et des sociétés', 1),
(71, 'Administration de l''état', 1),
(72, 'Collectivité territoriale', 1),
(73, 'Établissement public administratif', 1),
(74, 'Autre personne morale de droit public administratif', 1),
(81, 'Organisme gérant un régime de protection sociale à adhésion obligatoire', 1),
(82, 'Organisme mutualiste', 1),
(83, 'Comité d''entreprise', 1),
(84, 'Organisme professionnel', 1),
(91, 'Syndicat de propriétaires', 1),
(92, 'Association loi 1901 ou assimilé', 1),
(93, 'Fondation', 1),
(99, 'Autre personne morale de droit privé', 1),
(1000, 'Entrepreneur Individuel à Responsabilité Limité', 0),
(1100, 'Artisan Commerçant', 1),
(1200, 'Commerçant', 1),
(1300, 'Artisan', 1),
(1400, 'Officier public ou ministériel', 1),
(1500, 'Profession libérale', 1),
(1600, 'Exploitant agricole', 1),
(1700, 'Agent commercial', 1),
(1800, 'Associé Gérant de société', 1),
(1900, '(Autre) personne physique', 1),
(2100, 'Indivision', 0),
(2110, 'Indivision entre personnes physiques', 1),
(2120, 'Indivision avec personne morale', 1),
(2200, 'Société créée de fait', 0),
(2210, 'Société créée de fait entre personnes physiques', 1),
(2220, 'Société créée de fait avec personne morale', 1),
(2300, 'Société en participation', 0),
(2310, 'Société en participation entre personnes physiques', 1),
(2320, 'Société en participation avec personne morale', 1),
(2385, 'Société en participation de professions libérales', 1),
(2400, 'Fiducie', 1),
(2700, 'Paroisse hors zone concordataire', 1),
(2900, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
(3110, 'Représentation ou agence commerciale d''état ou organisme public étranger immatriculé au RCS', 1),
(3120, 'Société étrangère immatriculée au RCS', 1),
(3205, 'Organisation internationale', 1),
(3210, 'État collectivité ou établissement public étranger', 1),
(3220, 'Société étrangère non immatriculée au RCS', 1),
(3290, '(Autre) personne morale de droit étranger', 1),
(4110, 'Établissement public national à caractère industriel ou commercial doté d''un comptable public', 1),
(4120, 'Établissement public national à caractère industriel ou commercial non doté d''un comptable public', 1),
(4130, 'Exploitant public', 1),
(4140, 'Établissement public local à caractère industriel ou commercial', 1),
(4150, 'Régie d''une collectivité locale à caractère industriel ou commercial', 1),
(4160, 'Institution Banque de France', 1),
(5191, 'Société de caution mutuelle', 1),
(5192, 'Société coopérative de banque populaire', 1),
(5193, 'Caisse de crédit maritime mutuel', 1),
(5194, 'Caisse (fédérale) de crédit mutuel', 1),
(5195, 'Association coopérative inscrite ( droit local Alsace Moselle )', 1),
(5196, 'Caisse d''épargne et de prévoyance à forme coopérative', 1),
(5202, 'Société en nom collectif', 1),
(5203, 'Société en nom collectif coopérative', 1),
(5306, 'Société en commandite simple', 1),
(5307, 'Société en commandite simple coopérative', 1),
(5308, 'Société en commandite par actions', 1),
(5309, 'Société en commandite par actions coopérative', 1),
(5385, 'Société d''exercice libéral en commandite par action', 1),
(5410, 'SARL nationale', 1),
(5415, 'SARL d''économie mixte', 1),
(5422, 'SARL immobilière pour le commerce et l''industrie (SICOMI)', 1),
(5426, 'Société immobilière de gestion', 1),
(5430, 'Safer en SARL', 1),
(5431, 'SARL mixte d''intérêt agricole', 1),
(5432, 'SARL d''intérêt collectif agricole', 1),
(5442, 'SARL d''attribution', 1),
(5443, 'SARL coopérative de construction', 1),
(5451, 'SARL coopérative de consommation', 1),
(5453, 'SARL coopérative artisanale', 1),
(5454, 'SARL coopérative d''intérêt maritime', 1),
(5455, 'SARL coopérative de transports', 1),
(5458, 'SARL coopérative ouvrière de production et de crédit', 1),
(5459, 'SARL union de sociétés coopératives', 1),
(5460, 'Autre SARL coopérative', 1),
(5485, 'Société d''exercice libéral à responsabilité limitée', 1),
(5488, 'Entreprise Unipersonnelle à Responsabilité Limitée', 1),
(5498, 'SARL unipersonnelle', 1),
(5499, 'Autre société à responsabilité limitée', 1),
(5505, 'SA à participation ouvrière à conseil d''administration', 1),
(5510, 'SA nationale à conseil d''administration', 1),
(5515, 'SA d''économie mixte à conseil d''administration', 1),
(5520, 'Société d''investissement à capital variable (SICAV) à conseil d''administration', 1),
(5522, 'Société anonyme immobilière pour le commerce et l''industrie (SICOMI) à conseil d''administration', 1),
(5525, 'Société anonyme immobilière d''investissement à conseil d''administration', 1),
(5530, 'Safer anonyme à conseil d''administration', 1),
(5531, 'Société anonyme mixte d''intérêt agricole (SMIA) à conseil d''administration', 1),
(5532, 'Société anonyme mixte d''intérêt collectif agricole (SICA) à conseil d''administration', 1),
(5542, 'Société anonyme d''attribution à conseil d''administration', 1),
(5543, 'Société anonyme coopérative de construction à conseil d''administration', 1),
(5546, 'SA de HLM à conseil d''administration', 1),
(5547, 'SA coopérative de production de HLM à conseil d''administration', 1),
(5548, 'SA de crédit immobilier à conseil d''administration', 1),
(5551, 'SA coopérative de consommation à conseil d''administration', 1),
(5552, 'SA coopérative de commerçants détaillants à conseil d''administration', 1),
(5553, 'SA coopérative artisanale à conseil d''administration', 1),
(5554, 'SA coopérative (d''intérêt) maritime à conseil d''administration', 1),
(5555, 'SA coopérative de transports à conseil d''administration', 1),
(5558, 'SA coopérative ouvrière de production et de crédit (SCOP) à conseil d''administration', 1),
(5559, 'SA union de sociétés coopératives à conseil d''administration', 1),
(5560, 'Autre SA coopérative à conseil d''administration', 1),
(5585, 'Société d''exercice libéral à forme anonyme à conseil d''administration', 1),
(5599, 'Autre SA à conseil d''administration', 1),
(5605, 'SA à participation ouvrière à directoire', 1),
(5610, 'SA nationale à directoire', 1),
(5615, 'SA d''économie mixte à directoire', 1),
(5620, 'Société d''investissement à capital variable (SICAV) à directoire', 1),
(5622, 'Société immobilière pour le commerce et l''industrie (SICOMI) anonyme à directoire', 1),
(5625, 'Société immobilière d''investissement anonyme à directoire', 1),
(5630, 'Safer anonyme à directoire', 1),
(5631, 'Société anonyme mixte d''intérêt agricole', 1),
(5632, 'Société anonyme d''intérêt collectif agricole', 1),
(5642, 'Société anonyme d''attribution à directoire', 1),
(5643, 'Société anonyme coopérative de construction à directoire', 1),
(5646, 'Société anonyme de HLM à directoire', 1),
(5647, 'Société coopérative de production de HLM anonyme à directoire', 1),
(5648, 'SA de crédit immobilier à directoire', 1),
(5651, 'SA coopérative de consommation à directoire', 1),
(5652, 'SA coopérative de commerçants détaillants à directoire', 1),
(5653, 'SA coopérative artisanale à directoire', 1),
(5654, 'SA coopérative (d''intérêt) maritime à directoire', 1),
(5655, 'SA coopérative de transport à directoire', 1),
(5658, 'SA coopérative ouvrière de production et de crédit (SCOP) à directoire', 1),
(5659, 'SA union de sociétés coopératives à directoire', 1),
(5660, '(Autre) SA coopérative à directoire', 1),
(5685, 'Société d''exercice libéral à forme anonyme à directoire', 1),
(5699, 'Autre SA à directoire', 1),
(5710, 'Société par actions simplifiée', 1),
(5720, 'Société par actions simplifiée à associé unique ou société par actions simplifiée unipersonnelle', 1),
(5785, 'Société dexercice libéral par action simplifiée', 1),
(5800, 'Société européenne', 1),
(6100, 'Caisse dépargne et de prévoyance', 1),
(6200, 'Groupement d''intérêt économique', 0),
(6210, 'Groupement européen dintérêt économique', 1),
(6220, 'Groupement dintérêt économique', 1),
(6316, 'Coopérative dutilisation de matériel agricole en commun', 1),
(6317, 'Société coopérative agricole', 1),
(6318, 'Union de sociétés coopératives agricoles', 1),
(6411, 'Société dassurance mutuelle', 1),
(6412, 'Société mutuelle d''assurance', 1),
(6413, 'Union de sociétés mutuelles d''assurances', 1),
(6414, 'Autre société non commerciale d''assurance', 1),
(6521, 'Société civile de placement collectif immobilier', 1),
(6532, 'Société civile dintérêt collectif agricole', 1),
(6533, 'Groupement agricole dexploitation en commun', 1),
(6534, 'Groupement foncier agricole', 1),
(6535, 'Groupement agricole foncier', 1),
(6536, 'Groupement forestier', 1),
(6537, 'Groupement pastoral', 1),
(6538, 'Groupement foncier rural', 1),
(6539, 'Société civile foncière', 1),
(6540, 'Société civile immobilière', 1),
(6541, 'Société civile immobilière de construction vente', 1),
(6542, 'Société civile dattribution', 1),
(6543, 'Société civile coopérative de construction', 1),
(6544, 'Société immobilière d''accession progressive à la propriété', 1),
(6551, 'Société civile coopérative de consommation', 1),
(6554, 'Société civile coopérative (dintérêt) maritime', 1),
(6558, 'Société civile coopérative entre médecins', 1),
(6560, 'Autre société civile coopérative', 1),
(6561, 'SCP davocats', 1),
(6562, 'SCP davocats aux conseil', 1),
(6563, 'SCP davoués dappel', 1),
(6564, 'SCP dhuissiers', 1),
(6565, 'SCP de notaires', 1),
(6566, 'SCP de commissaires-priseurs', 1),
(6567, 'SCP de greffiers de tribunal de commerce', 1),
(6568, 'SCP de conseils juridiques', 1),
(6569, 'SCP de commissaires aux comptes', 1),
(6571, 'SCP de médecins', 1),
(6572, 'SCP de dentistes', 1),
(6573, 'SCP dinfirmiers', 1),
(6574, 'SCP de masseurs kinésithérapeutes', 1),
(6575, 'SCP de directeurs de laboratoire danalyse médicale', 1),
(6576, 'SCP de vétérinaires', 1),
(6577, 'SCP de géomètres-experts', 1),
(6578, 'SCP darchitectes', 1),
(6585, '(Autres) Société Civile professionnelle', 1),
(6588, 'Société civile laitière', 0),
(6589, 'Société civile de moyens', 1),
(6595, 'Caisse (locale) de crédit mutuel', 1),
(6596, 'Caisse de crédit agricole mutuel', 1),
(6597, 'Société civile dexploitation agricole', 1),
(6598, 'Exploitation agricole à responsabilité limitée', 1),
(6599, 'Autre société civile', 1),
(6901, 'Autres personnes de droit privé inscrites au registre du commerce et des sociétés', 1),
(7111, 'Autorité constitutionnelle', 1),
(7112, 'Autorité administrative indépendante', 1),
(7113, 'Ministère', 1),
(7120, 'Service central dun ministère', 1),
(7130, 'Service du ministère des Postes et Télécommunications', 1),
(7150, 'Service du ministère de la Défense', 1),
(7160, 'Service déconcentré à compétence nation. Dun ministère (hors Défense)', 1),
(7171, 'Service déconcentré de lÉtat à compétence (inter) régionale', 1),
(7172, 'Service déconcentré de lÉtat à compétence (inter) départementale', 1),
(7179, '(Autre) Service déconcentré de lÉtat à compétence territoriale', 1),
(7190, 'Ecole nationale non dotée de la personnalité morale', 1),
(7210, 'Commune', 1),
(7220, 'Département', 1),
(7225, 'Territoire dOutre-mer', 1),
(7229, '(Autre) Collectivité territoriale', 1),
(7230, 'Région', 1),
(7312, 'Commune associée', 1),
(7313, 'Section de commune', 1),
(7314, 'Ensemble urbain', 1),
(7321, 'Association syndicale autorisée', 1),
(7322, 'Association foncière urbaine', 1),
(7323, 'Association foncière de remembrement', 1),
(7331, 'Établissement public local denseignement', 1),
(7341, 'Secteur de commune', 1),
(7342, 'District urbain', 1),
(7343, 'Communauté urbaine', 1),
(7345, 'Syndicat intercommunal à vocation multiple', 1),
(7346, 'Communauté de communes', 1),
(7347, 'Communauté de villes', 1),
(7348, 'Communauté d''agglomération', 1),
(7349, 'Autre établissement public local de coopération non spécialisé ou entente', 1),
(7351, 'Institution interdépartemental ou entente', 1),
(7352, 'Institution interrégionale ou entente', 1),
(7353, 'Syndicat intercommunal à vocation unique', 1),
(7354, 'Syndicat mixte communal', 1),
(7355, 'Autre syndicat mixte', 1),
(7356, 'Commission syndicale pour la gestion des biens indivis des communes', 1),
(7361, 'Centre communal d''action sociale', 1),
(7362, 'Caisse des écoles', 1),
(7363, 'Caisse de crédit municipal', 1),
(7364, 'Établissement d''hospitalisation', 1),
(7365, 'Syndicat inter hospitalier', 1),
(7366, 'Établissement public local social et médico-social', 1),
(7371, 'Office public d''habitation à loyer modéré', 1),
(7372, 'Service départemental d''incendie', 1),
(7373, 'Établissement public local culturel', 1),
(7378, 'Régie d''une collectivité locale à caractère administratif', 1),
(7379, '(Autre) Établissement public administratif local', 1),
(7381, 'Organisme consulaire', 1),
(7382, 'Établissement public national ayant fonction d''administration centrale', 1),
(7383, 'Établissement public national à caractère scientifique culturel et professionnel', 1),
(7384, 'Autre établissement public national d''enseignement', 1),
(7385, 'Autre établissement public national administratif à compétence territoriale limitée', 1),
(7389, 'Établissement public national à caractère administratif', 1),
(7410, 'Groupement d''intérêt public', 1),
(7430, 'Établissement public des cultes d''Alsace-Lorraine', 1),
(7450, 'Etablissement public administratif, cercle et foyer dans les armées', 1),
(7470, 'Groupement de coopération sanitaire à gestion publique', 1),
(7490, 'Autre personne morale de droit administratif', 1),
(7510, 'Service d''une collectivité locale à comptabilité distincte', 1),
(7520, 'Régie d''une collectivité locale non dotée de la personnalité morale', 1),
(8110, 'Régime général de la sécurité sociale', 1),
(8120, 'Régime spécial de sécurité sociale', 1),
(8130, 'Institution de retraite complémentaire', 1),
(8140, 'Mutualité sociale agricole', 1),
(8150, 'Régime maladie des non-salariés non agricoles', 1),
(8160, 'Régime vieillesse ne dépendant pas du régime général de la sécurité sociale', 1),
(8170, 'Régime d''assurance chômage', 1),
(8190, 'Autre régime de prévoyance sociale', 1),
(8210, 'Mutuelle', 1),
(8250, 'Assurance mutuelle agricole', 1),
(8290, 'Autre organisme mutualiste', 1),
(8310, 'Comité central d''entreprise', 1),
(8311, 'Comité d''établissement', 1),
(8410, 'Syndicat de salariés', 1),
(8420, 'Syndicat patronal', 1),
(8450, 'Ordre professionnel ou assimilé', 1),
(8470, 'Centre technique industriel ou comité professionnel du développement économique', 1),
(8490, 'Autre organisme professionnel', 1),
(8510, 'Institution de prévoyance', 1),
(8520, 'Institution de retraite supplémentaire ', 1),
(9110, 'Syndicat de copropriété', 1),
(9150, 'Association syndicale libre', 1),
(9210, 'Association non déclarée', 1),
(9220, 'Association déclarée', 1),
(9221, 'Association déclarée "entreprises d''insertion par l''économique"', 1),
(9222, 'Association intermédiaire', 1),
(9223, 'Groupement d''employeurs', 1),
(9224, 'Association d''avocats à responsabilité professionnelle individuelle', 1),
(9230, 'Association déclarée reconnue d''utilité publique', 1),
(9240, 'Congrégation', 1),
(9260, 'Association de droit local', 1),
(9300, 'Fondation', 1),
(9900, 'Autre personne morale de droit privé', 1),
(9970, 'Groupement de coopération sanitaire à gestion privée', 1);

View File

@ -0,0 +1,5 @@
CREATE TABLE `fields_minmax` (
`cle` VARCHAR(20) PRIMARY KEY NOT NULL,
`min` INTEGER NOT NULL,
`max` BIGINT NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
--
-- Structure de la table `regions`
--
CREATE TABLE IF NOT EXISTS `fields_regions` (
`REGION` tinyint(2) unsigned zerofill NOT NULL,
`CHEFLIEU` char(5) NOT NULL,
`TNCC` char(1) NOT NULL,
`NC` char(30) NOT NULL,
`NCCENR` char(30) NOT NULL,
PRIMARY KEY (`REGION`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Contenu de la table `regions`
--
INSERT INTO `fields_regions` (`REGION`, `CHEFLIEU`, `TNCC`, `NC`, `NCCENR`) VALUES
(01, '97105', '3', 'GUADELOUPE', 'Guadeloupe'),
(02, '97209', '3', 'MARTINIQUE', 'Martinique'),
(03, '97302', '3', 'GUYANE', 'Guyane'),
(04, '97411', '0', 'LA REUNION', 'La Réunion'),
(11, '75056', '1', 'ILE-DE-FRANCE', 'Île-de-France'),
(21, '51108', '0', 'CHAMPAGNE-ARDENNE', 'Champagne-Ardenne'),
(22, '80021', '0', 'PICARDIE', 'Picardie'),
(23, '76540', '0', 'HAUTE-NORMANDIE', 'Haute-Normandie'),
(24, '45234', '2', 'CENTRE', 'Centre'),
(25, '14118', '0', 'BASSE-NORMANDIE', 'Basse-Normandie'),
(26, '21231', '0', 'BOURGOGNE', 'Bourgogne'),
(31, '59350', '2', 'NORD-PAS-DE-CALAIS', 'Nord-Pas-de-Calais'),
(41, '57463', '0', 'LORRAINE', 'Lorraine'),
(42, '67482', '1', 'ALSACE', 'Alsace'),
(43, '25056', '0', 'FRANCHE-COMTE', 'Franche-Comté'),
(52, '44109', '4', 'PAYS DE LA LOIRE', 'Pays de la Loire'),
(53, '35238', '0', 'BRETAGNE', 'Bretagne'),
(54, '86194', '2', 'POITOU-CHARENTES', 'Poitou-Charentes'),
(72, '33063', '1', 'AQUITAINE', 'Aquitaine'),
(73, '31555', '0', 'MIDI-PYRENEES', 'Midi-Pyrénées'),
(74, '87085', '2', 'LIMOUSIN', 'Limousin'),
(82, '69123', '2', 'RHONE-ALPES', 'Rhône-Alpes'),
(83, '63113', '1', 'AUVERGNE', 'Auvergne'),
(91, '34172', '2', 'LANGUEDOC-ROUSSILLON', 'Languedoc-Roussillon'),
(93, '13055', '0', 'PROVENCE-ALPES-COTE D''AZUR', 'Provence-Alpes-Côte d''Azur'),
(94, '2A004', '0', 'CORSE', 'Corse'),
(98, '', '', 'TERRITOIRES D''OUTRE-MER', 'Territoires d''outre-mer'),
(99, '', '', 'ETRANGER', 'Etranger');

View File

@ -0,0 +1,64 @@
#!/usr/bin/php
<?php
//error_reporting(E_ALL & ~E_NOTICE);
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
//Copy configuration
$hostname = exec('echo $(hostname)');
passthru('cp -fv ./'.$hostname.'/application.ini '.APPLICATION_PATH.'/configs/application.ini');
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Affiche les informations d'utilisation",
'install' => "Installe et configure",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help))
{
echo $opts->getUsageMessage();
exit;
}
//Install
if(isset($opts->install))
{
//Création des répertoires
mkdir(APPLICATION_PATH . '/../data');
mkdir(APPLICATION_PATH . '/../data/sessions');
//Modification des permissions
passthru('chown -R www-data: '.APPLICATION_PATH.'/../');
passthru('chmod +x '.APPLICATION_PATH.'/../scripts/cron.php');
passthru('chmod +x '.APPLICATION_PATH.'/../scripts/jobs/*.php');
}

View File

@ -0,0 +1,58 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.session.save_path = APPLICATION_PATH "/../data/sessions"
resources.session.gc_maxlifetime = 86400
resources.session.cookie_lifetime = 86400
resources.session.remember_me_seconds = 86400
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.frontController.params.displayExceptions = 0
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"
autoloaderNamespaces[] = "Application_"
autoloaderNamespaces[] = "Scores_"
autoloaderNamespaces[] = "Form_"
; Scores configuration
profil.server.name = development
profil.webservice.location = sdsrvdev01
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=root
profil.db.ciblage.params.password=bj10sx
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312
[staging : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

View File

@ -0,0 +1,58 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.session.save_path = APPLICATION_PATH "/../data/sessions"
resources.session.gc_maxlifetime = 86400
resources.session.cookie_lifetime = 86400
resources.session.remember_me_seconds = 86400
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.frontController.params.displayExceptions = 0
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"
autoloaderNamespaces[] = "Application_"
autoloaderNamespaces[] = "Scores_"
autoloaderNamespaces[] = "Form_"
; Scores configuration
profil.server.name = development
profil.webservice.location = sdsrvdev01
profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1
profil.db.ciblage.params.username=root
profil.db.ciblage.params.password=bj10sx
profil.db.ciblage.params.dbname=ciblage
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.adapter=mysqli
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312
[staging : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

View File

@ -0,0 +1,37 @@
[server]
name = sdsrvdev01
[webservice]
location = sdsrvdev01
[databases]
db.adapter=mysqli
db.params.host=127.0.0.1
db.params.username=ciblage
db.params.password=z7jq8AhvrwqQJ4Yb
db.params.dbname=ciblage
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
jo.adapter=mysqli
jo.params.host=192.168.78.230
jo.params.username=ciblage
jo.params.password=z7jq8AhvrwqQJ4Yb
jo.params.dbname=jo
jo.params.persistent = true
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[sphinx]
host = 192.168.78.252
port = 3312
[mail]
method = smtp
smpt_port =
smtp_host = smtp.free.fr
support = supportdev@scores-decisions.com
supportdev = supportdev@scores-decisions.com
contact = supportdev@scores-decisions.com
production = supportdev@scores-decisions.com
[path]
data = "/sites/dataciblage"

70
scripts/cron.php Normal file
View File

@ -0,0 +1,70 @@
#!/usr/bin/php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
define('APPLICATION_ENV', 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Aide.",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help))
{
echo $opts->getUsageMessage();
exit;
}
$c = Zend_Registry::get('config');
$db = Zend_Db::factory($c->profil->db->ciblage);
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
$sql = $commandesM->select()
->where('idProfil != ?', 0)
->where("dateStart != '0000-00-00 00:00:00'")
->where("dateStop = '0000-00-00 00:00:00'");
$result = $commandesM->fetchAll($sql);
if (count($result)>0){
exit;
}
//Si pas de traitement en cours alors on lance
$sql = $commandesM->select()
->where('idProfil != ?', 0)
->where("dateStart = '0000-00-00 00:00:00'")
->where("dateStop = '0000-00-00 00:00:00'")
->order('dateAdded ASC')->limit(1);
$result = $commandesM->fetchAll($sql);
if (count($result)>0) {
$info = $result->current();
echo "Lancement enrichissement $info->id\n";
exec(realpath(dirname(__FILE__))."/enrichissement.php --id ".$info->id." &");
}

View File

@ -0,0 +1,58 @@
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
define('APPLICATION_ENV', 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Aide.",
'cron' => "",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help))
{
echo $opts->getUsageMessage();
exit;
}
//Cron indexing
if(isset($opts->cron))
{
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$db = Zend_Db::factory($dbConfig->jo);
//Début de l'indexation
//Execution de l'indexation
//Fin de l'indexation
//Minimum - Maximum
}

View File

@ -0,0 +1,245 @@
#!/usr/bin/php
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
define('APPLICATION_ENV', 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Aide.",
'id=s' => "Identifiant du traitement",
'file=s' => "Identifiant pour les traitements par fichier"
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help) || !isset($opts->id) && !isset($opts->file) )
{
echo $opts->getUsageMessage(); exit;
}
$config = new Zend_Config($application->getOptions());
//MetadataCache pour la base de données
$frontendOptions = array(
'lifetime' => 14400,
'automatic_serialization' => true
);
$backendOptions = array();
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
//Définition bdd
try {
$db = Zend_Db::factory($config->profil->db->ciblage);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
$liste = array();
if ($opts->id)
{
//Read SIRETs
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
$commande = $commandesM->find(intval($opts->id))->current();
$identifiants = json_decode($commande->identifiants, true);
//Read profil for data extract
$profilM = new Application_Model_EnrichissementProfils($db);
$profil = $profilM->find(intval($commande->idProfil))->current();
$dataProfil = json_decode($profil->criteres, true);
}
else if ($opts->file)
{
}
//Something is needed
if ( count($identifiants)==0 || count($dataProfil)==0 ) {
echo "Identifiants:".count($identifiants).", profil:".$count($profil)."\n";
exit;
}
//Let's go
$mois = substr($commande->dateAdded,0,4).substr($commande->dateAdded,5,2);
if(!file_exists($config->path->data.'/'.$mois))
mkdir($config->path->data.'/'.$mois);
$path = $config->path->data.'/'.$mois;
$outFile = $profil->login.'_'.$opts->id.'_'.date('YmdHis').'.csv';
require_once 'Scores/Enrichissement.php';
$dico = new Enrichissement();
$fields = $dico->getFields();
//Entete, Valeur de remplacement et Requete SQL
$tabEntete = array('siren', 'nic');
$tabEnteteLabel = array('SIREN', 'NIC');
$sql = 'SELECT LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
foreach ( $dataProfil as $item ) {
//Définition de l'entete
$tabEnteteLabel[] = $fields[$item]['label'];
$tabEntete[] = $item;
//Construction de la requete SQL
if ( array_key_exists('sql', $fields[$item]) ) {
$sql.= ' '.$fields[$item]['sql'].', ';
} else {
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
}
}
//Ajouter le champ presentRcs
$tabEntete[] = 'presentRcs';
$tabEnteteLabel[] = 'RCS';
$sql .= ' presentRcs';
//Pour chaque identifiant traiter les données
$row = 0;
$fp = fopen($path.'/'.$outFile, 'w');
//Ecrire l'entete
if (count($tabEnteteLabel)>0){
fputcsv($fp, $tabEnteteLabel, ',', '"');
}
//Mise à jour des éléments
if ($opts->id) {
$commandesM->update(array(
'dateStart'=>date('Y-m-d H:i:s'),
'fichier' => basename($outFile)
),
"id = ".$commande->id);
}
$model = $sql;
$traite = 0;
//Date de debut de traitement.
$dateStart = date('YmdHms');
foreach ($identifiants as $siret )
{
$sql = $model.' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
try {
$result = $dbMetier->fetchAll($sql);
$traite++;
} catch(Exception $e) {
echo $sql;
}
$tabData = $result[0];
//Trier pour la sortie
$tabSortie = array();
foreach($tabEntete as $key){
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
}
fputcsv($fp, $tabSortie, ',', '"');
//Mise à jour des lignes traitées dans la base
if ($opts->id) {
$commandesM->update(array('nbLigneTraites'=>$row), "id = ".$commande->id);
}
$row++;
}
fclose($fp);
if ($opts->id) {
$commandesM->update( array('dateStop' => date('Y-m-d H:i:s')) , "id = ".$commande->id);
}
/* == FUNCTION == */
/**
* Verifie si un SIREN est valide
* @param Le code SIREN dont on veut vérifier la validité.
* @return Un booléen qui vaut 'true' si le code SIREN passé en
* paramètre est valide, false sinon.
*/
function sirenValide($siren) {
if ( (strlen($siren) != 9) || (is_nan($siren)) )
$estValide = false;
else {
// Donc le SIREN est un numérique à 9 chiffres
$somme = 0;
$tmp = 0;
for ($cpt = 0; $cpt<strlen($siren); $cpt++) {
if (($cpt % 2) == 1) { // Les positions paires : 2ème, 4ème, 6ème et 8ème chiffre
$tmp = substr($siren, $cpt, 1) * 2; // On le multiplie par 2
if ($tmp > 9)
$tmp-= 9; // Si le résultat est supérieur à 9, on lui soustrait 9
}
else
$tmp = substr($siren, $cpt, 1);
$somme+= intval($tmp);
}
if (($somme % 10) == 0)
$estValide = true; // Si la somme est un multiple de 10 alors le SIREN est valide
else
$estValide = false;
}
return $estValide;
}
/**
* Verifie si un SIRET est valide
* @param Le code SIRET dont on veut vérifier la validité.
* @return Un booléen qui vaut 'true' si le code SIRET passé en
* paramètre est valide, false sinon.
*/
function siretValide($siret) {
if ( (strlen($siret) != 14) || (is_nan($siret)) )
$estValide = false;
else {
// Donc le SIRET est un numérique à 14 chiffres
// Les 9 premiers chiffres sont ceux du SIREN (ou RCS), les 4 suivants
// correspondent au numéro d'établissement
// et enfin le dernier chiffre est une clef de LUHN.
$somme = 0;
$tmp = 0;
for ($cpt = 0; $cpt<strlen($siret); $cpt++) {
if (($cpt % 2) == 0) { // Les positions impaires : 1er, 3è, 5è, etc...
$tmp = substr($siret, $cpt, 1) * 2; // On le multiplie par 2
if ($tmp > 9)
$tmp-= 9; // Si le résultat est supérieur à 9, on lui soustrait 9
}
else
$tmp = substr($siret, $cpt, 1);
$somme+= intval($tmp);
}
if (($somme % 10) == 0)
$estValide = true; // Si la somme est un multiple de 10 alors le SIRET est valide
else
$estValide = false;
}
return $estValide;
}

109
scripts/jobs/setMinMax.php Normal file
View File

@ -0,0 +1,109 @@
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
define('APPLICATION_ENV', 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Aide.",
'cron' => "Mode automatique",
'manuel' => "Mode manuel",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(isset($opts->help))
{
echo $opts->getUsageMessage();
exit;
}
$config = new Zend_Config($application->getOptions());
try {
$db = Zend_Db::factory($config->profil->db->ciblage);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
$keys = array(
'dateCrea_ent',
'dateCrea_etab',
'nbActio',
'nbPart',
'age_etab',
'age_entrep',
'nbEtab',
'eff_entrep',
'eff_etab',
'capital',
'dateImmat',
'bilAnnee',
'bilCloture',
'bilEE',
'bilFL',
'bilFK',
'bilFR',
'bilGF',
'bilGP',
'bilGW',
'bilHD',
'bilHH',
'bilHL',
'bilHM',
'bilHN',
'bilYP',
);
$sql = 'TRUNCATE TABLE fields_minmax';
if ( !$db->query($sql) ) {
die ('Impossible de vider la table fields_minmax');
}
foreach($keys as $key) {
//Lecture
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act';
$stmt = $dbMetier->query($sql);
$result = $stmt->fetchObject();
//Insertion
$data = array(
'cle' => $key,
'min' => $result->min,
'max' => $result->max,
);
$db->insert('fields_minmax', $data);
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
}
if ($opts->manuel) print("Terminé\n");