本文整理汇总了PHP中OC_Helper::rmdirr方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Helper::rmdirr方法的具体用法?PHP OC_Helper::rmdirr怎么用?PHP OC_Helper::rmdirr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Helper
的用法示例。
在下文中一共展示了OC_Helper::rmdirr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
foreach ($this->tmpDirs as $dir) {
\OC_Helper::rmdirr($dir);
}
parent::tearDown();
}
示例2: tearDown
public function tearDown()
{
foreach ($this->tmpDirs as $dir) {
\OC_Helper::rmdirr($dir);
}
\OC\Files\Filesystem::clearMounts();
\OC_User::setUserId('');
}
示例3: tearDown
protected function tearDown()
{
foreach ($this->tmpDirs as $dir) {
\OC_Helper::rmdirr($dir);
}
\OC\Files\Filesystem::clearMounts();
\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
\OC_User::setUserId('');
parent::tearDown();
}
示例4: tearDown
public function tearDown()
{
$u = new OC_User();
foreach ($this->users as $user) {
$u->deleteUser($user);
}
foreach ($this->tmpfiles as $file) {
\OC_Helper::rmdirr($file);
}
}
示例5: run
public function run(IOutput $output)
{
if (!\OC_Template::isAssetPipelineEnabled()) {
$output->info('Asset pipeline disabled -> nothing to do');
return;
}
$assetDir = \OC::$server->getConfig()->getSystemValue('assetdirectory', \OC::$SERVERROOT) . '/assets';
\OC_Helper::rmdirr($assetDir, false);
$output->info('Asset cache cleared.');
}
示例6: run
public function run()
{
if (!\OC_Template::isAssetPipelineEnabled()) {
$this->emit('\\OC\\Repair', 'info', array('Asset pipeline disabled -> nothing to do'));
return;
}
$assetDir = \OC::$server->getConfig()->getSystemValue('assetdirectory', \OC::$SERVERROOT) . '/assets';
\OC_Helper::rmdirr($assetDir, false);
$this->emit('\\OC\\Repair', 'info', array('Asset cache cleared.'));
}
示例7: run
public function run()
{
if (!\OC_Template::isAssetPipelineEnabled()) {
$this->emit('\\OC\\Repair', 'info', array('Asset pipeline disabled -> nothing to do'));
return;
}
$assetDir = \OC::$SERVERROOT . '/assets';
\OC_Helper::rmdirr($assetDir, false);
$this->emit('\\OC\\Repair', 'info', array('Asset cache cleared.'));
}
示例8: getPackage
public static function getPackage($url, $version)
{
$path = \OC_Helper::tmpFile();
if (!copy($url, $path)) {
\OC_Log::write(App::APP_ID, "Failed to download {$url} package to {$path}", \OC_Log::ERROR);
return false;
}
//Mimetype bug workaround
$mime = rtrim(\OC_Helper::getMimeType($path), ';');
if ($mime == 'application/zip') {
rename($path, $path . '.zip');
$path .= '.zip';
} elseif ($mime == 'application/x-gzip') {
rename($path, $path . '.tgz');
$path .= '.tgz';
} elseif ($mime == 'application/x-bzip2') {
rename($path, $path . '.tar.bz2');
$path .= '.tar.bz2';
} else {
\OC_Log::write(App::APP_ID, 'Archives of type ' . $mime . ' are not supported', \OC_Log::ERROR);
return false;
}
$extractDir = self::getPackageDir($version);
if (!mkdir($extractDir, 0777, true)) {
\OC_Log::write(App::APP_ID, 'Unable to create temporary directory', \OC_Log::ERROR);
return false;
}
$archive = \OC_Archive::open($path);
if ($archive) {
$archive->extract($extractDir);
} else {
\OC_Log::write(App::APP_ID, "Failed to open package {$path}", \OC_Log::ERROR);
\OC_Helper::rmdirr($extractDir);
@unlink($path);
return false;
}
return $extractDir . DIRECTORY_SEPARATOR . self::PACKAGE_ROOT;
}
示例9: tearDown
protected function tearDown()
{
foreach ($this->tmpDirs as $dir) {
\OC_Helper::rmdirr($dir);
}
$this->logout();
$this->invokePrivate('\\OC\\Files\\Filesystem', 'normalizedPathCache', [null]);
parent::tearDown();
}
示例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) {
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;
}
示例11: removeApp
/**
* Removes an app
* @param string $name name of the application to remove
* @param array $options options
* @return boolean
*
* This function removes an app. $options is an associative array. The
* following keys are optional:ja
* - keeppreferences: boolean, if true the user preferences won't be deleted
* - keepappconfig: boolean, if true the config will be kept
* - keeptables: boolean, if true the database will be kept
* - keepfiles: boolean, if true the user files will be kept
*
* This function works as follows
* -# including appinfo/remove.php
* -# removing the files
*
* The function will not delete preferences, tables and the configuration,
* this has to be done by the function oc_app_uninstall().
*/
public static function removeApp($name, $options = array())
{
if (isset($options['keeppreferences']) and $options['keeppreferences'] == false) {
// todo
// remove preferences
}
if (isset($options['keepappconfig']) and $options['keepappconfig'] == false) {
// todo
// remove app config
}
if (isset($options['keeptables']) and $options['keeptables'] == false) {
// todo
// remove app database tables
}
if (isset($options['keepfiles']) and $options['keepfiles'] == false) {
// todo
// remove user files
}
if (OC_Installer::isDownloaded($name)) {
$appdir = OC_App::getInstallPath() . '/' . $name;
OC_Helper::rmdirr($appdir);
return true;
} else {
OC_Log::write('core', 'can\'t remove app ' . $name . '. It is not installed.', OC_Log::ERROR);
return false;
}
}
示例12: tearDown
protected function tearDown() {
\OC_Helper::rmdirr($this->tmpDir);
parent::tearDown();
}
示例13: removeIfExists
/**
* Silently remove the filesystem item
* Used for cleanup
* @param string $path
*/
public static function removeIfExists($path)
{
if (!file_exists($path)) {
return;
}
if (is_dir($path)) {
\OC_Helper::rmdirr($path);
} else {
@unlink($path);
}
}
示例14: installApp
/**
* @brief Installs an app
* @param $data array with all information
* @returns integer
*
* This function installs an app. All information needed are passed in the
* associative array $data.
* The following keys are required:
* - source: string, can be "path" or "http"
*
* One of the following keys is required:
* - path: path to the file containing the app
* - href: link to the downloadable file containing the app
*
* The following keys are optional:
* - pretend: boolean, if set true the system won't do anything
* - noinstall: boolean, if true appinfo/install.php won't be loaded
* - inactive: boolean, if set true the appconfig/app.sample.php won't be
* renamed
*
* This function works as follows
* -# fetching the file
* -# unzipping it
* -# check the code
* -# installing the database at appinfo/database.xml
* -# including appinfo/install.php
* -# setting the installed version
*
* It is the task of oc_app_install to create the tables and do whatever is
* needed to get the app working.
*/
public static function installApp($data = array())
{
if (!isset($data['source'])) {
OC_Log::write('core', 'No source specified when installing app', OC_Log::ERROR);
return false;
}
//download the file if necesary
if ($data['source'] == 'http') {
$path = OC_Helper::tmpFile();
if (!isset($data['href'])) {
OC_Log::write('core', 'No href specified when installing app from http', OC_Log::ERROR);
return false;
}
copy($data['href'], $path);
} else {
if (!isset($data['path'])) {
OC_Log::write('core', 'No path specified when installing app from local file', OC_Log::ERROR);
return false;
}
$path = $data['path'];
}
//detect the archive type
$mime = OC_Helper::getMimeType($path);
if ($mime == 'application/zip') {
rename($path, $path . '.zip');
$path .= '.zip';
} elseif ($mime == 'application/x-gzip') {
rename($path, $path . '.tgz');
$path .= '.tgz';
} else {
OC_Log::write('core', 'Archives of type ' . $mime . ' are not supported', OC_Log::ERROR);
return false;
}
//extract the archive in a temporary folder
$extractDir = OC_Helper::tmpFolder();
OC_Helper::rmdirr($extractDir);
mkdir($extractDir);
if ($archive = OC_Archive::open($path)) {
$archive->extract($extractDir);
} else {
OC_Log::write('core', 'Failed to open archive when installing app', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if ($data['source'] == 'http') {
unlink($path);
}
return false;
}
//load the info.xml file of the app
if (!is_file($extractDir . '/appinfo/info.xml')) {
//try to find it in a subdir
$dh = opendir($extractDir);
while ($folder = readdir($dh)) {
if (substr($folder, 0, 1) != '.' and is_dir($extractDir . '/' . $folder)) {
if (is_file($extractDir . '/' . $folder . '/appinfo/info.xml')) {
$extractDir .= '/' . $folder;
}
}
}
}
if (!is_file($extractDir . '/appinfo/info.xml')) {
OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
if ($data['source'] == 'http') {
unlink($path);
}
return false;
}
$info = OC_App::getAppInfo($extractDir . '/appinfo/info.xml', true);
$basedir = OC::$APPSROOT . '/apps/' . $info['id'];
//.........这里部分代码省略.........
示例15: installApp
/**
* @brief Installs an app
* @param $data array with all information
* @returns integer
*
* This function installs an app. All information needed are passed in the
* associative array $data.
* The following keys are required:
* - source: string, can be "path" or "http"
*
* One of the following keys is required:
* - path: path to the file containing the app
* - href: link to the downloadable file containing the app
*
* The following keys are optional:
* - pretend: boolean, if set true the system won't do anything
* - noinstall: boolean, if true appinfo/install.php won't be loaded
* - inactive: boolean, if set true the appconfig/app.sample.php won't be
* renamed
*
* This function works as follows
* -# fetching the file
* -# unzipping it
* -# installing the database at appinfo/database.xml
* -# including appinfo/install.php
* -# setting the installed version
*
* It is the task of oc_app_install to create the tables and do whatever is
* needed to get the app working.
*/
public static function installApp($data = array())
{
if (!isset($data['source'])) {
if (defined("DEBUG") && DEBUG) {
error_log("No source specified when installing app");
}
return false;
}
//download the file if necesary
if ($data['source'] == 'http') {
$path = tempnam(sys_get_temp_dir(), 'oc_installer_');
if (!isset($data['href'])) {
if (defined("DEBUG") && DEBUG) {
error_log("No href specified when installing app from http");
}
return false;
}
copy($data['href'], $path);
} else {
if (!isset($data['path'])) {
if (defined("DEBUG") && DEBUG) {
error_log("No path specified when installing app from local file");
}
return false;
}
$path = $data['path'];
}
//extract the archive in a temporary folder
$extractDir = tempnam(sys_get_temp_dir(), 'oc_installer_uncompressed_');
unlink($extractDir);
mkdir($extractDir);
$zip = new ZipArchive();
if ($zip->open($path) === true) {
$zip->extractTo($extractDir);
$zip->close();
} else {
if (defined("DEBUG") && DEBUG) {
error_log("Failed to open archive when installing app");
}
OC_Helper::rmdirr($extractDir);
if ($data['source'] == 'http') {
unlink($path);
}
return false;
}
//load the info.xml file of the app
if (!is_file($extractDir . '/appinfo/info.xml')) {
if (defined("DEBUG") && DEBUG) {
error_log("App does not provide an info.xml file");
}
OC_Helper::rmdirr($extractDir);
if ($data['source'] == 'http') {
unlink($path);
}
return false;
}
$info = OC_App::getAppInfo($extractDir . '/appinfo/info.xml');
$basedir = OC::$SERVERROOT . '/apps/' . $info['id'];
//check if an app with the same id is already installed
if (self::isInstalled($info['id'])) {
if (defined("DEBUG") && DEBUG) {
error_log("App already installed");
}
OC_Helper::rmdirr($extractDir);
if ($data['source'] == 'http') {
unlink($path);
}
return false;
}
//check if the destination directory already exists
//.........这里部分代码省略.........
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:101,代码来源:owncloud_lib_installer.php