Exemplo n.º 1
0
	public function update($tmpDir = '') {
		Helper::mkdir($tmpDir, true);
		$this->collect();
		try {
			foreach ($this->appsToUpdate as $appId) {
				if (!@file_exists($this->newBase . '/' . $appId)){
					continue;
				}
				$path = \OC_App::getAppPath($appId);
				if ($path) {
					Helper::move($path, $tmpDir . '/' . $appId);
					
					// ! reverted intentionally
					$this->done [] = array(
						'dst' => $path,
						'src' => $tmpDir . '/' . $appId
					);
					
					Helper::move($this->newBase . '/' . $appId, $path);
				} else { 
					// The app is new and doesn't exist in the current instance
					$pathData = first(\OC::$APPSROOTS);
					Helper::move($this->newBase . '/' . $appId, $pathData['path'] . '/' . $appId);
				}
			}
			$this->finalize();
		} catch (\Exception $e) {
			$this->rollback(true);
			throw $e;
		}
	}
Exemplo n.º 2
0
 protected function finalize()
 {
     // overwrite themes content with new files only
     $themes = $this->toAbsolute($this->newBase . '/themes', Helper::scandir($this->newBase . '/themes'));
     foreach ($themes as $name => $location) {
         Helper::removeIfExists($this->oldBase . '/themes/' . $name);
         Helper::move($location, $this->oldBase . '/themes/' . $name);
     }
     parent::finalize();
 }