当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::mkdir方法代码示例

本文整理汇总了PHP中Helper::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::mkdir方法的具体用法?PHP Helper::mkdir怎么用?PHP Helper::mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::mkdir方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Perform backup
  * @return string
  */
 public static function create()
 {
     $collection = new Collection();
     $locations = Helper::getPreparedLocations();
     foreach ($locations as $type => $dirs) {
         foreach ($dirs as $name => $path) {
             Helper::checkr($path, $collection);
         }
     }
     if (count($collection->getNotReadable()) || count($collection->getNotWritable())) {
         $e = new PermissionException();
         $e->setCollection($collection);
         throw $e;
     }
     try {
         Helper::mkdir(self::getPath(), true);
         foreach ($locations as $type => $dirs) {
             $backupFullPath = self::getPath() . '/' . $type . '/';
             Helper::mkdir($backupFullPath, true);
             foreach ($dirs as $name => $path) {
                 Helper::copyr($path, $backupFullPath . $name);
             }
         }
     } catch (\Exception $e) {
         App::log('Backup creation failed. Disk full?');
         self::cleanUp();
         throw new FsException($e->getMessage());
     }
     return self::getPath();
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:34,代码来源:backup.php

示例2: update

 public static function update($version, $backupBase)
 {
     if (!is_dir($backupBase)) {
         throw new \Exception("Backup directory {$backupBase} is not found");
     }
     set_include_path($backupBase . PATH_SEPARATOR . $backupBase . '/core/lib' . PATH_SEPARATOR . $backupBase . '/core/config' . PATH_SEPARATOR . $backupBase . '/3rdparty' . PATH_SEPARATOR . $backupBase . '/apps' . PATH_SEPARATOR . get_include_path());
     $tempDir = self::getTempDir();
     Helper::mkdir($tempDir, true);
     $installed = Helper::getDirectories();
     $sources = Helper::getSources($version);
     try {
         $thirdPartyUpdater = new Location_3rdparty($installed[Helper::THIRDPARTY_DIRNAME], $sources[Helper::THIRDPARTY_DIRNAME]);
         $thirdPartyUpdater->update($tempDir . '/' . Helper::THIRDPARTY_DIRNAME);
         self::$processed[] = $thirdPartyUpdater;
         $coreUpdater = new Location_Core($installed[Helper::CORE_DIRNAME], $sources[Helper::CORE_DIRNAME]);
         $coreUpdater->update($tempDir . '/' . Helper::CORE_DIRNAME);
         self::$processed[] = $coreUpdater;
         $appsUpdater = new Location_Apps('', $sources[Helper::APP_DIRNAME]);
         $appsUpdater->update($tempDir . '/' . Helper::APP_DIRNAME);
         self::$processed[] = $appsUpdater;
     } catch (\Exception $e) {
         self::rollBack();
         self::cleanUp();
         throw $e;
     }
     // zip backup
     $zip = new \ZipArchive();
     if ($zip->open($backupBase . ".zip", \ZIPARCHIVE::CREATE) === true) {
         Helper::addDirectoryToZip($zip, $backupBase, $backupBase);
         $zip->close();
         \OCP\Files::rmdirr($backupBase);
     }
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:34,代码来源:updater.php

示例3: update

 public static function update($version, $backupBase)
 {
     if (!is_dir($backupBase)) {
         throw new \Exception("Backup directory {$backupBase} is not found");
     }
     set_include_path($backupBase . PATH_SEPARATOR . $backupBase . '/core/lib' . PATH_SEPARATOR . $backupBase . '/core/config' . PATH_SEPARATOR . $backupBase . '/3rdparty' . PATH_SEPARATOR . $backupBase . '/apps' . PATH_SEPARATOR . get_include_path());
     $tempDir = self::getTempDir();
     Helper::mkdir($tempDir, true);
     try {
         foreach (self::prepare($version) as $location) {
             Helper::move($location['src'], $location['dst']);
             self::$processed[] = array('src' => $location['dst'], 'dst' => $location['src']);
         }
     } catch (\Exception $e) {
         self::rollBack();
         self::cleanUp();
         throw $e;
     }
     $config = "/config/config.php";
     copy($backupBase . "/" . Helper::CORE_DIRNAME . $config, \OC::$SERVERROOT . $config);
     // zip backup
     $zip = new \ZipArchive();
     if ($zip->open($backupBase . ".zip", \ZIPARCHIVE::CREATE) === true) {
         Helper::addDirectoryToZip($zip, $backupBase, $backupBase);
         $zip->close();
         \OC_Helper::rmdirr($backupBase);
     }
     // Disable removed apps
     foreach (self::getAppsToRemove() as $appId) {
         \OC_App::disable($appId);
     }
     return true;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:33,代码来源:updater.php

示例4: update

	public function update($tmpDir = '') {
		Helper::mkdir($tmpDir, true);
		$collected = $this->collect();

		try {
			foreach ($collected['old'] as $src) {
				$dst = str_replace($this->oldBase, $tmpDir, $src);
				Helper::move($src, $dst);

				// ! reverted intentionally
				$this->done [] = array(
					'dst' => $src,
					'src' => $dst
				);
			}

			foreach ($collected['new'] as $src) {
				$dst = str_replace($this->newBase, $this->oldBase, $src);
				Helper::move($src, $dst);
			}

			$this->finalize();
		} catch (\Exception $e) {
			$this->rollback(true);
			throw $e;
		}
	}
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:27,代码来源:location.php

示例5: getPackage

 public static function getPackage($url, $version)
 {
     self::$package = App::getBackupBase() . $version;
     if (preg_match('/\\.zip$/i', $url)) {
         $type = '.zip';
     } elseif (preg_match('/(\\.tgz|\\.tar\\.gz)$/i', $url)) {
         $type = '.tgz';
     } elseif (preg_match('/\\.tar\\.bz2$/i', $url)) {
         $type = '.tar.bz2';
     } else {
         throw new \Exception('Unable to extract package ' . $url . ': unknown format');
     }
     self::$package = self::$package . $type;
     try {
         // Reuse already downloaded package
         if (!file_exists(self::$package)) {
             if (self::fetch($url) === false) {
                 throw new \Exception("Error storing package content");
             }
             App::log('Downloaded ' . filesize(self::$package) . ' bytes.', \OCP\Util::DEBUG);
         } else {
             App::log('Use already downloaded package ' . self::$package . '. Size is ' . filesize(self::$package) . ' bytes.', \OCP\Util::DEBUG);
         }
         $extractDir = self::getPackageDir($version);
         Helper::mkdir($extractDir, true);
         $archive = \OC_Archive::open(self::$package);
         if (!$archive || !$archive->extract($extractDir)) {
             throw new \Exception(self::$package . " extraction error");
         }
     } catch (\Exception $e) {
         App::log('Retrieving ' . $url);
         self::cleanUp($version);
         throw $e;
     }
     //  Prepare extracted data
     //  to have '3rdparty', 'apps' and 'core' subdirectories
     $baseDir = $extractDir . '/' . self::PACKAGE_ROOT;
     if (!file_exists($baseDir)) {
         App::log('Expected fresh sources in ' . $baseDir . '. Nothing is found. Something is wrong with OC_Archive.');
         App::log($extractDir . ' content: ' . implode(' ', scandir($extractDir)));
         if ($type === '.zip' && !extension_loaded('zip')) {
             $hint = App::$l10n->t('Please ask your server administrator to enable PHP zip extension.');
         }
         throw new \Exception(self::$package . " extraction error. " . $hint);
     }
     include $baseDir . '/version.php';
     Helper::checkVersion($OC_Version, $OC_VersionString);
     $sources = Helper::getSources($version);
     rename($baseDir . '/' . Helper::THIRDPARTY_DIRNAME, $sources[Helper::THIRDPARTY_DIRNAME]);
     rename($baseDir . '/' . Helper::APP_DIRNAME, $sources[Helper::APP_DIRNAME]);
     rename($baseDir, $sources[Helper::CORE_DIRNAME]);
 }
开发者ID:samj1912,项目名称:repo,代码行数:52,代码来源:downloader.php

示例6: update

 public static function update($version, $backupBase)
 {
     if (!is_dir($backupBase)) {
         throw new \Exception("Backup directory {$backupBase} is not found");
     }
     // Switch include paths to backup
     $pathsArray = explode(PATH_SEPARATOR, get_include_path());
     $pathsTranslated = [];
     foreach ($pathsArray as $path) {
         //Update all 3rdparty paths
         if (preg_match('|^' . preg_quote(\OC::$THIRDPARTYROOT . '/3rdparty') . '|', $path)) {
             $pathsTranslated[] = preg_replace('|^' . preg_quote(\OC::$THIRDPARTYROOT . '/3rdparty') . '|', $backupBase . '/3rdparty', $path);
             continue;
         }
         // Update all OC webroot paths
         $pathsTranslated[] = preg_replace('|^' . preg_quote(\OC::$SERVERROOT) . '|', $backupBase, $path);
     }
     set_include_path(implode(PATH_SEPARATOR, $pathsTranslated));
     $tempDir = self::getTempDir();
     Helper::mkdir($tempDir, true);
     $installed = Helper::getDirectories();
     $sources = Helper::getSources($version);
     try {
         $thirdPartyUpdater = new \OCA\Updater\Location\Thirdparty($installed[Helper::THIRDPARTY_DIRNAME], $sources[Helper::THIRDPARTY_DIRNAME]);
         $thirdPartyUpdater->update($tempDir . '/' . Helper::THIRDPARTY_DIRNAME);
         self::$processed[] = $thirdPartyUpdater;
         $coreUpdater = new \OCA\Updater\Location\Core($installed[Helper::CORE_DIRNAME], $sources[Helper::CORE_DIRNAME]);
         $coreUpdater->update($tempDir . '/' . Helper::CORE_DIRNAME);
         self::$processed[] = $coreUpdater;
         $appsUpdater = new \OCA\Updater\Location\Apps('', $sources[Helper::APP_DIRNAME]);
         $appsUpdater->update($tempDir . '/' . Helper::APP_DIRNAME);
         self::$processed[] = $appsUpdater;
     } catch (\Exception $e) {
         self::rollBack();
         self::cleanUp();
         throw $e;
     }
     // zip backup
     $zip = new \ZipArchive();
     if ($zip->open($backupBase . ".zip", \ZIPARCHIVE::CREATE) === true) {
         Helper::addDirectoryToZip($zip, $backupBase);
         $zip->close();
         \OCP\Files::rmdirr($backupBase);
     }
     return true;
 }
开发者ID:samj1912,项目名称:repo,代码行数:46,代码来源:updater.php

示例7: create

 /**
  * Perform backup
  * @return string
  */
 public static function create()
 {
     try {
         $locations = Helper::getPreparedLocations();
         Helper::mkdir(self::getPath(), true);
         foreach ($locations as $type => $dirs) {
             $backupFullPath = self::getPath() . '/' . $type . '/';
             Helper::mkdir($backupFullPath, true);
             foreach ($dirs as $name => $path) {
                 Helper::copyr($path, $backupFullPath . $name);
             }
         }
     } catch (\Exception $e) {
         self::cleanUp();
         throw $e;
     }
     return self::getPath();
 }
开发者ID:netcon-source,项目名称:apps,代码行数:22,代码来源:backup.php

示例8: getPackage

 public static function getPackage($url, $version)
 {
     self::$package = \OC_Helper::tmpFile();
     if (!self::$package) {
         throw new \Exception('Unable to create a temporary file');
     }
     try {
         if (file_put_contents(self::$package, self::fetch($url)) === false) {
             throw new \Exception("Error storing package content");
         }
         if (preg_match('/\\.zip$/i', $url)) {
             rename(self::$package, self::$package . '.zip');
             self::$package .= '.zip';
         } elseif (preg_match('/(\\.tgz|\\.tar\\.gz)$/i', $url)) {
             rename(self::$package, self::$package . '.tgz');
             self::$package .= '.tgz';
         } elseif (preg_match('/\\.tar\\.bz2$/i', $url)) {
             rename(self::$package, self::$package . '.tar.bz2');
             self::$package .= '.tar.bz2';
         } else {
             throw new \Exception('Unable to extract package');
         }
         $extractDir = self::getPackageDir($version);
         Helper::mkdir($extractDir, true);
         $archive = \OC_Archive::open(self::$package);
         if (!$archive || !$archive->extract($extractDir)) {
             throw new \Exception(self::$package . " extraction error");
         }
     } catch (\Exception $e) {
         App::log('Retrieving ' . $url);
         self::cleanUp($version);
         throw $e;
     }
     Helper::removeIfExists(self::$package);
     //  Prepare extracted data
     //  to have '3rdparty', 'apps' and 'core' subdirectories
     $sources = Helper::getSources($version);
     $baseDir = $extractDir . '/' . self::PACKAGE_ROOT;
     @rename($baseDir . '/' . Helper::THIRDPARTY_DIRNAME, $sources[Helper::THIRDPARTY_DIRNAME]);
     @rename($baseDir . '/' . Helper::APP_DIRNAME, $sources[Helper::APP_DIRNAME]);
     @rename($baseDir, $sources[Helper::CORE_DIRNAME]);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:42,代码来源:downloader.php

示例9: update

 public function update($tmpDir = '')
 {
     Helper::mkdir($tmpDir, true);
     $this->collect(true);
     try {
         foreach ($this->appsToUpdate as $appId) {
             $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);
             }
         }
         $this->finalize();
     } catch (\Exception $e) {
         $this->rollback(true);
         throw $e;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:apps.php

示例10: update

 public static function update($version, $backupBase)
 {
     if (!is_dir($backupBase)) {
         throw new \Exception("Backup directory {$backupBase} is not found");
     }
     set_include_path($backupBase . PATH_SEPARATOR . $backupBase . '/core/lib' . PATH_SEPARATOR . $backupBase . '/core/config' . PATH_SEPARATOR . $backupBase . '/3rdparty' . PATH_SEPARATOR . $backupBase . '/apps' . PATH_SEPARATOR . get_include_path());
     $tempDir = self::getTempDir();
     Helper::mkdir($tempDir, true);
     try {
         foreach (self::prepare($version) as $location) {
             Helper::move($location['src'], $location['dst']);
             self::$processed[] = array('src' => $location['dst'], 'dst' => $location['src']);
         }
     } catch (\Exception $e) {
         App::log('Something went wrong. Rolling back.');
         self::rollBack();
         self::cleanUp();
         throw $e;
     }
     // move old config files
     $backupConfigPath = $backupBase . "/" . Helper::CORE_DIRNAME . "/config/";
     foreach (glob($backupConfigPath . "*.php") as $configFile) {
         $target = \OC::$SERVERROOT . "/config/" . basename($configFile);
         if (!file_exists($target)) {
             copy($configFile, $target);
         }
     }
     // zip backup
     $zip = new \ZipArchive();
     if ($zip->open($backupBase . ".zip", \ZIPARCHIVE::CREATE) === true) {
         Helper::addDirectoryToZip($zip, $backupBase, $backupBase);
         $zip->close();
         \OC_Helper::rmdirr($backupBase);
     }
     // Disable removed apps
     foreach (self::getAppsToRemove() as $appId) {
         \OC_App::disable($appId);
     }
     return true;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:40,代码来源:updater.php

示例11: getPackage

 public static function getPackage($url, $version)
 {
     self::$package = \OC_Helper::tmpFile();
     try {
         if (!copy($url, self::$package)) {
             throw new \Exception("Failed to download {$url} package");
         }
         if (preg_match('/\\.zip$/i', $url)) {
             rename(self::$package, self::$package . '.zip');
             self::$package .= '.zip';
         } elseif (preg_match('/(\\.tgz|\\.tar\\.gz)$/i', $url)) {
             rename(self::$package, self::$package . '.tgz');
             self::$package .= '.tgz';
         } elseif (preg_match('/\\.tar\\.bz2$/i', $url)) {
             rename(self::$package, self::$package . '.tar.bz2');
             self::$package .= '.tar.bz2';
         } else {
             throw new \Exception('Unable to extract package');
         }
         $extractDir = self::getPackageDir($version);
         Helper::mkdir($extractDir, true);
         $archive = \OC_Archive::open(self::$package);
         if ($archive) {
             $archive->extract($extractDir);
         } else {
             throw new \Exception(self::$package . " extraction error");
         }
     } catch (\Exception $e) {
         self::cleanUp($version);
         throw $e;
     }
     Helper::removeIfExists(self::$package);
     //  Prepare extracted data
     //  to have '3rdparty', 'apps' and 'core' subdirectories
     $sources = Helper::getSources($version);
     $baseDir = $extractDir . '/' . self::PACKAGE_ROOT;
     @rename($baseDir . '/' . Helper::THIRDPARTY_DIRNAME, $sources[Helper::THIRDPARTY_DIRNAME]);
     @rename($baseDir . '/' . Helper::APP_DIRNAME, $sources[Helper::APP_DIRNAME]);
     @rename($baseDir, $sources[Helper::CORE_DIRNAME]);
 }
开发者ID:netcon-source,项目名称:apps,代码行数:40,代码来源:downloader.php

示例12: create

 /**
  * Perform backup
  * @return string
  */
 public static function create($version)
 {
     $collection = new Collection();
     $installed = Helper::getDirectories();
     $sources = Helper::getSources($version);
     $thirdPartyUpdater = new \OCA\Updater\Location\Thirdparty($installed[Helper::THIRDPARTY_DIRNAME], $sources[Helper::THIRDPARTY_DIRNAME]);
     $coreUpdater = new \OCA\Updater\Location\Core($installed[Helper::CORE_DIRNAME], $sources[Helper::CORE_DIRNAME]);
     $appUpdater = new \OCA\Updater\Location\Apps($installed[Helper::APP_DIRNAME], '');
     $thirdPartyFiles = $thirdPartyUpdater->collect(true);
     $coreFiles = $coreUpdater->collect(true);
     $appFiles = $appUpdater->collect(true);
     $locations = array(Helper::THIRDPARTY_DIRNAME => $thirdPartyFiles['old'], Helper::CORE_DIRNAME => $coreFiles['old'], Helper::APP_DIRNAME => $appFiles['old']);
     foreach ($locations as $type => $dirs) {
         foreach ($dirs as $name => $path) {
             Helper::checkr($path, $collection);
         }
     }
     if (count($collection->getNotReadable()) || count($collection->getNotWritable())) {
         $e = new PermissionException();
         $e->setCollection($collection);
         throw $e;
     }
     try {
         Helper::mkdir(self::getPath(), true);
         foreach ($locations as $type => $dirs) {
             $backupFullPath = self::getPath() . '/' . $type . '/';
             Helper::mkdir($backupFullPath, true);
             foreach ($dirs as $name => $path) {
                 Helper::copyr($path, $backupFullPath . $name);
             }
         }
     } catch (\Exception $e) {
         \OC::$server->getLogger()->error('Backup creation failed. Disk full?', ['app' => 'updater']);
         self::cleanUp();
         throw new FsException($e->getMessage());
     }
     return self::getPath();
 }
开发者ID:FelixHsieh,项目名称:updater,代码行数:42,代码来源:backup.php

示例13: internalImgs

 static function internalImgs($html, $outDir = null, $headers = array())
 {
     $root = Helper::getWebroot(true);
     //Diretório raiz do site
     $basePath = dirname(Helper::normalizeSeps(Yii::app()->basePath, '/'));
     $baseUrlFull = Helper::getBaseUrl(true);
     if ($outDir == null) {
         $outDir = $root . DS . 'assets' . DS . 'external';
     }
     Helper::mkdir($outDir);
     $imgs = self::extrairImgs($html, true);
     CRequests::downloadFiles($imgs, $outDir, $headers, true);
     foreach ($imgs as $img) {
         $path = $img[0] == '/' ? $root . $img : $img;
         //Gera um path ou usa o que foi lido
         if (strpos($path, $baseUrlFull) !== 0) {
             $internalPath = CRequests::downloadFile($path, $outDir, $headers, true);
             $internalPath = Helper::normalizeSeps($internalPath, '/');
             $internalUrl = str_replace($basePath, $baseUrlFull, $internalPath);
             $html = str_replace($path, $internalUrl, $html);
         }
     }
     return $html;
 }
开发者ID:bruno-melo,项目名称:components,代码行数:24,代码来源:HtmlParser.php

示例14: isset

<?php

/**
 * ownCloud - Updater plugin
 *
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA\Updater;

\OCP\User::checkAdminUser();
\OCP\Util::addScript(App::APP_ID, '3rdparty/angular');
\OCP\Util::addScript(App::APP_ID, 'app');
\OCP\Util::addScript(App::APP_ID, 'controllers');
\OCP\Util::addStyle(App::APP_ID, 'updater');
if (!@file_exists(App::getBackupBase())) {
    Helper::mkdir(App::getBackupBase());
}
$data = App::getFeed();
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'admin');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false');
$tmpl->assign('channels', Channel::getChannels());
$tmpl->assign('currentChannel', Channel::getCurrentChannel());
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
return $tmpl->fetchPage();
开发者ID:samj1912,项目名称:repo,代码行数:31,代码来源:admin.php


注:本文中的Helper::mkdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。