diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php index 74099057ce..0a59c55afa 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php @@ -76,7 +76,7 @@ class Subdefs implements ControllerProviderInterface { $subdefs = $databox->get_subdef_structure(); $UnicodeProcessor = new \unicode(); - + $group = $add_subdef['group']; $name = $UnicodeProcessor->remove_nonazAZ09($add_subdef['name'], false); $class = $add_subdef['class']; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php b/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php index 3e224ae144..d42a0c809c 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/UserPreferences.php @@ -66,4 +66,4 @@ class UserPreferences implements ControllerProviderInterface return $controllers; } -} \ No newline at end of file +} diff --git a/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php index 05e35cc1fe..f5ad9d0c29 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php +++ b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php @@ -242,7 +242,7 @@ class Doctrine extends ServiceAbstract implements ServiceInterface , realpath(__DIR__ . '/../../../../../Doctrine') ); $classLoader->register(); - + $classLoader = new \Doctrine\Common\ClassLoader( 'Events' , realpath(__DIR__ . '/../../../../../Doctrine') diff --git a/lib/Alchemy/Phrasea/Helper/Record/Edit.php b/lib/Alchemy/Phrasea/Helper/Record/Edit.php index a003341b59..f982a77250 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Edit.php @@ -511,7 +511,7 @@ class Edit extends RecordHelper { return $this; } - + $sbas_id = (int) $request->get('sbid'); $databox = \databox::get_instance($sbas_id); $meta_struct = $databox->get_meta_structure(); diff --git a/lib/Alchemy/Phrasea/Loader/Autoloader.php b/lib/Alchemy/Phrasea/Loader/Autoloader.php index fea917d1ef..75401eb97e 100644 --- a/lib/Alchemy/Phrasea/Loader/Autoloader.php +++ b/lib/Alchemy/Phrasea/Loader/Autoloader.php @@ -25,13 +25,13 @@ class Autoloader extends UniversalClassLoader { /** * An array of path to check - * @var type + * @var type */ private $paths = array(); - + /** * Construct a new phrasea Autoloader - * Because some custom classes from library folder might be + * Because some custom classes from library folder might be * overwritten in config folder * Phraseanet Loader look classes in configuration folders first * then check library folder if no classes where matched @@ -41,7 +41,7 @@ class Autoloader extends UniversalClassLoader $this->paths['config'] = __DIR__ . '/../../../../config/classes/'; $this->paths['library'] = __DIR__ . '/../../../classes/'; } - + /** * {@inheritdoc} */ @@ -58,35 +58,35 @@ class Autoloader extends UniversalClassLoader /** * Add a path to look for autoloading phraseanet classes * @param string $name - * @param string $path + * @param string $path */ public function addPath($name, $path) { $this->paths[$name] = \p4string::addEndSlash($path); } - + /** * Check whether a class with $class name exists * foreach declared paths * @param string $class - * @return mixed string|null + * @return mixed string|null */ private function checkFile($class) { foreach($this->paths as $path) { $file = $path. str_replace('_', '/', $class) . '.class.php'; - + if(file_exists($file)) { return $file; } } } - + /** * Get Paths where classes are checked for autoloading - * @return Array + * @return Array */ public function getPaths() { diff --git a/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php b/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php index c56c6a87db..458cc603e9 100644 --- a/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php +++ b/lib/Alchemy/Phrasea/Loader/CacheAutoloader.php @@ -75,12 +75,12 @@ class CacheAutoloader extends Autoloader } $method = new $className(); - + if($namespace) { $method->setNamespace($namespace); } - + if ($method instanceof LoaderStrategy && $method->isAvailable()) { $this->cacheAdapter = $method; diff --git a/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php b/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php index 86ac617017..5741278321 100644 --- a/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php +++ b/lib/Alchemy/Phrasea/Loader/LoaderStrategy.php @@ -22,7 +22,7 @@ interface LoaderStrategy /** * Check wether the cacheAdapter is available - * @Return boolean + * @Return boolean */ public function isAvailable(); diff --git a/lib/Doctrine/Repositories/StoryWZRepository.php b/lib/Doctrine/Repositories/StoryWZRepository.php index fd2e5990d2..a8e96aa4df 100644 --- a/lib/Doctrine/Repositories/StoryWZRepository.php +++ b/lib/Doctrine/Repositories/StoryWZRepository.php @@ -56,6 +56,7 @@ class StoryWZRepository extends EntityRepository { return 0; } + return ($a->getRecord()->get_title() < $b->getRecord()->get_title()) ? -1 : 1; } diff --git a/lib/classes/ACL.class.php b/lib/classes/ACL.class.php index 767b804f18..667af5771b 100644 --- a/lib/classes/ACL.class.php +++ b/lib/classes/ACL.class.php @@ -336,11 +336,11 @@ class ACL implements cache_cacheableInterface $mask_and = $template_user->ACL()->get_mask_and($base_id); $mask_xor = $template_user->ACL()->get_mask_xor($base_id); - + $mask_and = ctype_digit($mask_and) ? $mask_and : '0'; $mask_xor = ctype_digit($mask_xor) ? $mask_xor : '0'; - - + + /** * apply sb is substractive */ diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index f3b6a6fb31..1f9950f096 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -1112,6 +1112,7 @@ class API_V1_adapter extends API_V1_Abstract * @todo ajouter une option pour avoir les values serialisées * dans un cas multi */ + return array( 'meta_id' => $value->getId() , 'meta_structure_id' => $field->get_meta_struct_id() diff --git a/lib/classes/User/Adapter.class.php b/lib/classes/User/Adapter.class.php index bbb48927a3..4fb4256405 100644 --- a/lib/classes/User/Adapter.class.php +++ b/lib/classes/User/Adapter.class.php @@ -1490,7 +1490,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { return $this->_prefs[$prop]; } - + $ok = true; if (isset(self::$available_values[$prop])) diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index 15d1dfa073..f85bae8a07 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -180,12 +180,12 @@ abstract class base implements cache_cacheableInterface */ public function get_data_from_cache($option = null) { - + if($this->get_base_type() == self::DATA_BOX) { \cache_databox::refresh($this->id); } - + return $this->get_cache()->get($this->get_cache_key($option)); } diff --git a/lib/classes/caption/record.class.php b/lib/classes/caption/record.class.php index c7b21d17d0..fc99c71940 100644 --- a/lib/classes/caption/record.class.php +++ b/lib/classes/caption/record.class.php @@ -137,6 +137,7 @@ class caption_record implements caption_interface, cache_cacheableInterface foreach ($this->retrieve_fields() as $meta_struct_id => $field) { if ($field->get_name() == $fieldname) + return $field; } diff --git a/lib/classes/databox/field.class.php b/lib/classes/databox/field.class.php index 25b2b5e647..afdabcc906 100644 --- a/lib/classes/databox/field.class.php +++ b/lib/classes/databox/field.class.php @@ -192,7 +192,7 @@ class databox_field implements cache_cacheableInterface } catch (Exception $e) { - + } if ($row['dces_element']) @@ -234,7 +234,7 @@ class databox_field implements cache_cacheableInterface /** * - * @return boolean + * @return boolean */ public function isVocabularyRestricted() { @@ -677,7 +677,7 @@ class databox_field implements cache_cacheableInterface } catch (Exception $e) { - + } return $this; diff --git a/lib/classes/geonames.class.php b/lib/classes/geonames.class.php index 1597df478d..bd3d494677 100644 --- a/lib/classes/geonames.class.php +++ b/lib/classes/geonames.class.php @@ -100,6 +100,7 @@ class geonames $cityName = self::clean_input($cityName); if (strlen($cityName) === 0) + return $output; $registry = registry::get_instance(); @@ -140,6 +141,7 @@ class geonames public function find_geoname_from_ip($ip) { if (array_key_exists($ip, $this->cache_ips)) + return $this->cache_ips[$ip]; $output = array( diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php index d70cb5f3ed..28c88e0e26 100644 --- a/lib/classes/mail.class.php +++ b/lib/classes/mail.class.php @@ -144,7 +144,7 @@ class mail public static function mail_confirm_registered($email) { $registry = \registry::get_instance(); - + $subject = _('login::register: sujet email : confirmation de votre adresse email'); $body = "
" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n"; diff --git a/lib/classes/module/console/fileConfigCheck.class.php b/lib/classes/module/console/fileConfigCheck.class.php index 809403d2b4..fc7804f437 100644 --- a/lib/classes/module/console/fileConfigCheck.class.php +++ b/lib/classes/module/console/fileConfigCheck.class.php @@ -87,6 +87,7 @@ class module_console_fileConfigCheck extends Command if (!$this->configuration->isInstalled()) { $output->writeln(sprintf("\nPhraseanet is not installed\n")); + return 1; } } @@ -102,7 +103,7 @@ class module_console_fileConfigCheck extends Command catch (\Exception $e) { $previous = $e->getPrevious(); - + $output->writeln(sprintf( "%s FATAL error : %s" , $e->getMessage() @@ -111,6 +112,7 @@ class module_console_fileConfigCheck extends Command ) ); $output->writeln(sprintf("\nConfig check test suite can not continue please correct FATAL error and relaunch.\n")); + return 1; } } @@ -138,6 +140,7 @@ class module_console_fileConfigCheck extends Command ); } } + return (int) ($nbErrors > 0); } diff --git a/lib/classes/module/console/fileEnsureProductionSetting.class.php b/lib/classes/module/console/fileEnsureProductionSetting.class.php index 627c63cbde..115b47ee4a 100644 --- a/lib/classes/module/console/fileEnsureProductionSetting.class.php +++ b/lib/classes/module/console/fileEnsureProductionSetting.class.php @@ -25,7 +25,7 @@ use Alchemy\Phrasea\Core; */ class module_console_fileEnsureProductionSetting extends Command { - + const ALERT = 1; const ERROR = 0; @@ -80,6 +80,7 @@ class module_console_fileEnsureProductionSetting extends Command if (!$this->configuration->isInstalled()) { $output->writeln(sprintf("\nPhraseanet is not installed\n")); + return 1; } } @@ -104,6 +105,7 @@ class module_console_fileEnsureProductionSetting extends Command ) ); $output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n")); + return 1; } } diff --git a/lib/classes/module/console/schedulerStart.class.php b/lib/classes/module/console/schedulerStart.class.php index 89207c0252..2bb6ed0898 100644 --- a/lib/classes/module/console/schedulerStart.class.php +++ b/lib/classes/module/console/schedulerStart.class.php @@ -44,12 +44,13 @@ class module_console_schedulerStart extends Command if (!setup::is_installed()) { $output->writeln('Phraseanet is not set up'); + return 1; } require_once __DIR__ . '/../../../../lib/bootstrap.php'; - + try { $scheduler = new task_Scheduler(); diff --git a/lib/classes/module/console/schedulerState.class.php b/lib/classes/module/console/schedulerState.class.php index 08b08eef56..e0c0571872 100644 --- a/lib/classes/module/console/schedulerState.class.php +++ b/lib/classes/module/console/schedulerState.class.php @@ -39,6 +39,7 @@ class module_console_schedulerState extends Command if (!setup::is_installed()) { $output->writeln('Phraseanet is not set up'); + return 1; } @@ -61,6 +62,7 @@ class module_console_schedulerState extends Command { $output->writeln(sprintf('Scheduler is %s', $state['schedstatus'])); } + return 0; } catch(\Exception $e) diff --git a/lib/classes/module/console/schedulerStop.class.php b/lib/classes/module/console/schedulerStop.class.php index b5c9ce06b8..1e99681d43 100644 --- a/lib/classes/module/console/schedulerStop.class.php +++ b/lib/classes/module/console/schedulerStop.class.php @@ -39,6 +39,7 @@ class module_console_schedulerStop extends Command if (!setup::is_installed()) { $output->writeln('Phraseanet is not set up'); + return 1; } @@ -49,6 +50,7 @@ class module_console_schedulerStop extends Command $appbox = appbox::get_instance(); $task_manager = new task_manager($appbox); $task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP); + return 0; } catch (\Exception $e) diff --git a/lib/classes/module/console/systemBackupDB.class.php b/lib/classes/module/console/systemBackupDB.class.php index 3408c677a6..7557b079ca 100644 --- a/lib/classes/module/console/systemBackupDB.class.php +++ b/lib/classes/module/console/systemBackupDB.class.php @@ -46,6 +46,7 @@ class module_console_systemBackupDB extends Command if (!setup::is_installed()) { $output->writeln('Argument must be an Id.'); + return 1; } @@ -56,7 +57,7 @@ class module_console_systemBackupDB extends Command $appbox = appbox::get_instance(); $ok = true; - + $ok = $this->dump_base($appbox, $input, $output) && $ok; foreach ($appbox->get_databoxes() as $databox) @@ -96,15 +97,17 @@ class module_console_systemBackupDB extends Command if (file_exists($filename) && filesize($filename) > 0) { $output->writeln('OK'); + return true; } else { $output->writeln('Failed'); + return false; } - + } } diff --git a/lib/classes/module/console/systemClearCache.class.php b/lib/classes/module/console/systemClearCache.class.php index 9c87a51bda..49ef5576da 100644 --- a/lib/classes/module/console/systemClearCache.class.php +++ b/lib/classes/module/console/systemClearCache.class.php @@ -47,7 +47,7 @@ class module_console_systemClearCache extends Command __DIR__ . '/../../../../tmp/cache_minify/' , __DIR__ . '/../../../../tmp/cache_twig/' )); - + $count = 1; foreach ($finder as $file) { @@ -64,7 +64,7 @@ class module_console_systemClearCache extends Command )) ->exclude('.git') ->exclude('.svn'); - + foreach ($finder as $file) { $dirs[$file->getPathname()] = $file->getPathname(); diff --git a/lib/classes/module/console/systemConfigCheck.class.php b/lib/classes/module/console/systemConfigCheck.class.php index f51e580444..8242dd7e59 100644 --- a/lib/classes/module/console/systemConfigCheck.class.php +++ b/lib/classes/module/console/systemConfigCheck.class.php @@ -46,7 +46,7 @@ class module_console_systemConfigCheck extends Command } $ok = true; - + if (setup::is_installed()) { $registry = registry::get_instance(); @@ -60,7 +60,7 @@ class module_console_systemConfigCheck extends Command $registry = new Setup_Registry(); } - + $output->writeln(_('*** FILESYSTEM CONFIGURATION ***')); $ok = $this->processConstraints(setup::check_writability($registry), $output) && $ok; @@ -99,6 +99,7 @@ class module_console_systemConfigCheck extends Command $hasError = true; } } + return !$hasError; } @@ -118,6 +119,7 @@ class module_console_systemConfigCheck extends Command { $output->writeln("\t/!\\\t" . $constraint->get_message() . ''); } + return $ok; } diff --git a/lib/classes/module/console/tasklist.class.php b/lib/classes/module/console/tasklist.class.php index 9dd88017c9..3215d4c19c 100644 --- a/lib/classes/module/console/tasklist.class.php +++ b/lib/classes/module/console/tasklist.class.php @@ -40,6 +40,7 @@ class module_console_tasklist extends Command if (!setup::is_installed()) { $output->writeln('Phraseanet is not set up'); + return 1; } @@ -60,6 +61,7 @@ class module_console_tasklist extends Command { $this->print_task($task, $output); } + return 0; } catch (\Exception $e) diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index 315b179fb0..64f519f0b2 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -48,6 +48,7 @@ class module_console_taskrun extends Command if (!setup::is_installed()) { $output->writeln('Phraseanet is not set up'); + return 1; } @@ -58,6 +59,7 @@ class module_console_taskrun extends Command if ($task_id <= 0 || strlen($task_id) !== strlen($input->getArgument('task_id'))) { $output->writeln('Argument must be an Id.'); + return 1; } @@ -73,9 +75,9 @@ class module_console_taskrun extends Command { $runner = task_abstract::RUNNER_MANUAL; } - + $task->run($runner); - + return 0; } catch (\exception $e) diff --git a/lib/classes/patch/3602.class.php b/lib/classes/patch/3602.class.php index 078ab33297..f707bfb2c4 100644 --- a/lib/classes/patch/3602.class.php +++ b/lib/classes/patch/3602.class.php @@ -64,4 +64,4 @@ class patch_3602 implements patchInterface return true; } -} \ No newline at end of file +} diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index 4c2ebbb370..7cd6b74206 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -1736,6 +1736,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $hd = $this->get_subdef('document'); if ($hd->is_physically_present()) + return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file()); return null; } diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index ee800f8a31..96f10811a9 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -211,6 +211,7 @@ class record_preview extends record_adapter public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null) { if ($this->train) + return $this->train; switch ($this->env) @@ -273,6 +274,7 @@ class record_preview extends record_adapter public function get_title($highlight = '', searchEngine_adapter $search_engine = null) { if ($this->title) + return $this->title; $this->title = collection::getLogo($this->get_base_id()) . ' '; @@ -329,6 +331,7 @@ class record_preview extends record_adapter public function get_short_history() { if (!is_null($this->short_history)) + return $this->short_history; $tab = array(); @@ -389,7 +392,7 @@ class record_preview extends record_adapter } catch (Exception $e) { - + } $tab[$hour][$site][$action][$row['usr_id']] = @@ -421,6 +424,7 @@ class record_preview extends record_adapter public function get_view_popularity() { if (!is_null($this->view_popularity)) + return $this->view_popularity; $appbox = appbox::get_instance(); $session = $appbox->get_session(); @@ -518,6 +522,7 @@ class record_preview extends record_adapter public function get_refferer_popularity() { if (!is_null($this->refferer_popularity)) + return $this->refferer_popularity; $appbox = appbox::get_instance(); $session = $appbox->get_session(); @@ -604,6 +609,7 @@ class record_preview extends record_adapter { if (!is_null($this->download_popularity)) + return $this->download_popularity; $appbox = appbox::get_instance(); $session = $appbox->get_session(); diff --git a/lib/classes/set/export.class.php b/lib/classes/set/export.class.php index d268e2309a..99e732886b 100644 --- a/lib/classes/set/export.class.php +++ b/lib/classes/set/export.class.php @@ -762,6 +762,7 @@ class set_export extends set_abstract return false; } if (isset($list['complete']) && $list['complete'] === true) + return; @@ -1053,7 +1054,7 @@ class set_export extends set_abstract $user = false; if ($anonymous) { - + } else { diff --git a/lib/classes/setup.class.php b/lib/classes/setup.class.php index ea67897772..780252d99d 100644 --- a/lib/classes/setup.class.php +++ b/lib/classes/setup.class.php @@ -614,15 +614,15 @@ class setup echo '