Example #1
0
 public static function cleanUp()
 {
     if (self::$path) {
         Helper::removeIfExists(self::$path);
     }
     Helper::removeIfExists(App::getTempBase());
 }
Example #2
0
 protected function filterOld($pathArray)
 {
     $skip = array_values(Helper::getDirectories());
     $skip[] = rtrim(App::getBackupBase(), '/');
     $skip[] = \OCP\Config::getSystemValue("datadirectory", \OC::$SERVERROOT . "/data");
     $skip[] = rtrim(App::getTempBase(), '/');
     // Skip 3rdparty | apps | backup | datadir | config | themes
     foreach ($pathArray as $key => $path) {
         if ($path === 'config' || $path === 'themes') {
             unset($pathArray[$key]);
         }
         if (in_array($this->oldBase . '/' . $path, $skip)) {
             unset($pathArray[$key]);
         }
     }
     return $pathArray;
 }
Example #3
0
 public static function getTempDir()
 {
     return App::getTempBase() . 'tmp';
 }
Example #4
0
 public static function getPackageDir($version)
 {
     return App::getTempBase() . $version;
 }
Example #5
0
	public static function filterLocations($locations, $basePath) {
		$fullPath = array_values(self::getDirectories());
		$fullPath[] = rtrim(App::getBackupBase(), '/');
		$fullPath[] = rtrim(App::getTempBase(), '/');
		$fullPath[] = \OCP\Config::getSystemValue( "datadirectory", \OC::$SERVERROOT."/data" );
		$fullPath[] = \OC::$SERVERROOT."/themes";
		
		foreach($fullPath as $key=>$path){
			$fullPath[] = realpath($path);
		}
		
		$exclusions = array(
			'full' => $fullPath,
			'relative' => array('.', '..')
		);
		
		foreach ($locations as $key => $location) {
			$fullPath = $basePath . '/' .$location;
			$realPath = realpath($fullPath);
			if (is_file($fullPath)) {
				continue;
			}
			if (in_array($fullPath, $exclusions['full'])
				|| in_array($realPath, $exclusions['full'])
				|| in_array($location, $exclusions['relative'])
			) {
				unset($locations[$key]);
			}
		}
		return $locations;
	}