/**
  * (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);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Parse the framework-object requested into the URL
  *
  * @param Request $pRequest 
  */
 protected function resolveRequest($pRequest)
 {
     $request = $pRequest->getRequestURI();
     if (empty($request)) {
         throw new ResolverException('Empty request URI in Resolver');
     }
     if (preg_match('/^\\/\\/+/', $request)) {
         \OatBox\Common\Logger::w('Multiple leading slashes in request URI: ' . $request);
         $request = '/' . ltrim($request, '/');
     }
     $rootUrlPath = $pRequest->getRootSubPath();
     $absPath = parse_url($request, PHP_URL_PATH);
     if (substr($absPath, 0, strlen($rootUrlPath)) != $rootUrlPath) {
         throw new ResolverException('Request Uri ' . $request . ' outside of TAO path ' . ROOT_URL);
     }
     $relPath = substr($absPath, strlen($rootUrlPath));
     $relPath = ltrim($relPath, '/');
     $tab = explode('/', $relPath);
     if (count($tab) > 0) {
         $this->module = isset($tab[0]) && !empty($tab[0]) ? $tab[0] : null;
         $this->action = isset($tab[1]) && !empty($tab[1]) ? $tab[1] : null;
     } else {
         throw new ResolverException('Empty request Uri ' . $request . ' reached resolver');
     }
 }
 /**
  * 
  * @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);
         }
     }
 }
Ejemplo n.º 4
0
 public function assets($asset)
 {
     if ($this->assetsUrl == null) {
         Common\Logger::w("View's assets not properly configured, check config variable ASSETS_DIR");
         return $asset;
     }
     return $this->assetsUrl . $asset;
 }
Ejemplo n.º 5
0
 /**
  * Copy a file from source to destination, may be done recursively and may ignore system files
  *
  * @access public
  * @author Lionel Lecaque, <*****@*****.**>
  * @param string source
  * @param string destination
  * @param boolean recursive
  * @param boolean ignoreSystemFiles
  * @return boolean
  */
 public static function copy($source, $destination, $recursive = true, $ignoreSystemFiles = true)
 {
     $returnValue = (bool) false;
     // Check for System File
     $basename = basename($source);
     if ($basename[0] == '.' && $ignoreSystemFiles == true) {
         return false;
     }
     // Check for symlinks
     if (is_link($source)) {
         return symlink(readlink($source), $destination);
     }
     // Simple copy for a file
     if (is_file($source)) {
         // get path info of destination.
         $destInfo = pathinfo($destination);
         if (isset($destInfo['dirname']) && !is_dir($destInfo['dirname'])) {
             if (!mkdir($destInfo['dirname'], 0777, true)) {
                 return false;
             }
         }
         return copy($source, $destination);
     }
     // Make destination directory
     if ($recursive == true) {
         if (!is_dir($destination)) {
             // 0777 is default. See mkdir PHP Official documentation.
             mkdir($destination, 0777, true);
         }
         // Loop through the folder
         $dir = dir($source);
         if ($dir == false) {
             Logger::w('Source ' . $source . ' not found');
         } else {
             while (false !== ($entry = $dir->read())) {
                 // Skip pointers
                 if ($entry == '.' || $entry == '..') {
                     continue;
                 }
                 // Deep copy directories
                 self::copy("{$source}/{$entry}", "{$destination}/{$entry}", $recursive, $ignoreSystemFiles);
             }
             // Clean up
             $dir->close();
         }
         return true;
     } else {
         return false;
     }
     return (bool) $returnValue;
 }