/**
  * (non-PHPdoc)
  * @see \OatBox\Common\ScriptRunner::run()
  */
 public function run()
 {
     $service = UpdateService::getInstance();
     $extManifests = $service->getUpdateManifests();
     $releaseManifest = $service->getReleaseManifest();
     $oldRootPath = $releaseManifest['old_root_path'];
     foreach ($extManifests as $ext => $update) {
         Logger::t('Moving Folder ' . $ext);
         File::move($oldRootPath . $ext, DIR_DATA . 'old/' . $ext, false);
     }
     $rootFiles = array('.htaccess', 'index.php', 'favicon.ico', 'fdl-1.3.txt', 'gpl-2.0.txt', 'license', 'version', 'readme.txt');
     foreach ($rootFiles as $file) {
         if (is_file($oldRootPath . $file)) {
             Logger::t('Moving File ' . $file);
             File::move($oldRootPath . $file, DIR_DATA . 'old/' . $file, false);
         } else {
             Logger::w('File not found : ' . $file);
         }
     }
 }
 public function execute()
 {
     $module = $this->context->getModuleName();
     $action = $this->context->getActionName();
     // if module exist include the class
     if ($module !== null) {
         $exptectedPath = DIR_APP . DIR_ACTIONS . $module . '.php';
         if (file_exists($exptectedPath)) {
             require_once $exptectedPath;
         } else {
             throw new ActionEnforcingException("Module '" . Helpers\Camelizer::firstToUpper($module) . "' does not exist in {$exptectedPath}.", $this->context->getModuleName(), $this->context->getActionName());
         }
         if (defined('ROOT_PATH')) {
             $root = realpath(ROOT_PATH);
         } else {
             $root = realpath($_SERVER['DOCUMENT_ROOT']);
         }
         if (preg_match("/^\\//", $root) && !preg_match("/\\/\$/", $root)) {
             $root .= '/';
         } else {
             if (!preg_match("/\\\$/", $root)) {
                 $root .= '\\';
             }
         }
         $relPath = str_replace($root, '', realpath(dirname($exptectedPath)));
         $relPath = str_replace('/', '\\', $relPath);
         $className = $relPath . '\\' . $module;
         if (!class_exists($className)) {
             throw new ActionEnforcingException("Unable to load  {$className} in {$exptectedPath}", $this->context->getModuleName(), $this->context->getActionName());
         }
         // File gracefully loaded.
         $this->context->setModuleName($module);
         $this->context->setActionName($action);
         $moduleInstance = new $className();
     } else {
         throw new ActionEnforcingException("No Module file matching requested module.", $this->context->getModuleName(), $this->context->getActionName());
     }
     // if the method related to the specified action exists, call it
     if (method_exists($moduleInstance, $action)) {
         // search parameters method
         $reflect = new \ReflectionMethod($className, $action);
         $parameters = $reflect->getParameters();
         $tabParam = array();
         foreach ($parameters as $param) {
             $tabParam[$param->getName()] = $this->context->getRequest()->getParameter($param->getName());
         }
         // Action method is invoked, passing request parameters as
         // method parameters.
         Common\Logger::t('Invoking ' . get_class($moduleInstance) . '::' . $action, array('GENERIS', 'CLEARRFW'));
         call_user_func_array(array($moduleInstance, $action), $tabParam);
         // Render the view if selected.
         if ($view = $moduleInstance->hasView()) {
             $renderer = $moduleInstance->getRenderer();
             $renderer->setTemplateDir(DIR_APP . DIR_VIEWS);
             $renderer->setAssetsUrl(ROOT_URL . DIR_ASSETS);
             echo $renderer->render();
         }
     } else {
         throw new ActionEnforcingException("Unable to find the appropriate action for Module '{$module}'.", $this->context->getModuleName(), $this->context->getActionName());
     }
 }
 /**
  * 
  * @access public
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param unknown $ext
  * @param unknown $data
  */
 private function restoreData($ext, $data)
 {
     if (is_array($data)) {
         foreach ($data as $d) {
             $this->restoreData($ext, $d);
         }
     } else {
         $releaseManifest = $this->getReleaseManifest();
         $srcPath = DIR_DATA . 'old/';
         $src = $srcPath . $ext . DIRECTORY_SEPARATOR . $data;
         $dest = $releaseManifest['old_root_path'] . $ext . DIRECTORY_SEPARATOR . $data;
         if (is_file($src) || is_dir($src)) {
             Logger::t('Copy ' . $src . ' to ' . $dest);
             File::copy($src, $dest, true, false);
         } else {
             Logger::w('Could not copy data ' . $src . ' from old installation, check extension manifest ' . $ext);
         }
     }
 }