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


PHP rex_file::delete方法代码示例

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


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

示例1: execute

 public function execute()
 {
     global $I18N;
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', array(array('upload_file', 'bool'), array('oldversion', 'string'), array('redaxo', 'array[string]'), array('description', 'string'), array('status', 'int'), array('replace_assets', 'bool'), array('ignore_tests', 'bool')));
     $file = array();
     $archive = null;
     $file['version'] = $upload['upload_file'] ? OOAddon::getVersion($addonkey) : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = stripslashes($upload['description']);
     $file['status'] = $upload['status'];
     if ($upload['upload_file']) {
         $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
         $exclude = array();
         if ($upload['replace_assets']) {
             $exclude[] = 'files';
         }
         if ($upload['ignore_tests']) {
             $exclude[] = 'tests';
         }
         rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
         if ($upload['replace_assets']) {
             rex_install_archive::copyDirToArchive(rex_path::addonAssets($addonkey), $archive, $addonkey . '/files');
         }
         $file['checksum'] = md5_file($archive);
     }
     rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), array('file' => $file), $archive);
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return $I18N->msg('install_info_addon_uploaded', $addonkey);
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:35,代码来源:api_package_upload.php

示例2: deleteCache

 public function deleteCache()
 {
     if ($this->id < 1) {
         return false;
     }
     $file = $this->getFilePath($this->getId());
     rex_file::delete($file);
     return true;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:9,代码来源:api_template.php

示例3: execute

 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', [['upload_file', 'bool'], ['oldversion', 'string'], ['redaxo', 'array[string]'], ['description', 'string'], ['status', 'int'], ['replace_assets', 'bool'], ['ignore_tests', 'bool']]);
     $file = [];
     $archive = null;
     $file['version'] = $upload['upload_file'] ? rex_addon::get($addonkey)->getVersion() : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = $upload['description'];
     $file['status'] = $upload['status'];
     try {
         if ($upload['upload_file']) {
             $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
             $exclude = [];
             if ($upload['replace_assets']) {
                 $exclude[] = 'assets';
             }
             if ($upload['ignore_tests']) {
                 $exclude[] = 'tests';
             }
             rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
             if ($upload['replace_assets']) {
                 rex_install_archive::copyDirToArchive(rex_url::addonAssets($addonkey), $archive, $addonkey . '/assets');
             }
             $file['checksum'] = md5_file($archive);
         }
         rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), ['file' => $file], $archive);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return new rex_api_result(true, rex_i18n::msg('install_info_addon_uploaded', $addonkey));
 }
开发者ID:staabm,项目名称:redaxo,代码行数:41,代码来源:api_package_upload.php

示例4: execute

 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $this->addonkey = rex_request('addonkey', 'string');
     $function = static::GET_PACKAGES_FUNCTION;
     $packages = rex_install_packages::$function();
     $this->fileId = rex_request('file', 'int');
     if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
         return null;
     }
     $this->file = $packages[$this->addonkey]['files'][$this->fileId];
     $this->checkPreConditions();
     try {
         $archivefile = rex_install_webservice::getArchive($this->file['path']);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     $message = '';
     $this->archive = $archivefile;
     if ($this->file['checksum'] != md5_file($archivefile)) {
         $message = rex_i18n::msg('install_warning_zip_wrong_checksum');
     } elseif (!$this->isCorrectFormat($archivefile)) {
         $message = rex_i18n::msg('install_warning_zip_wrong_format');
     } elseif (is_string($msg = $this->doAction())) {
         $message = $msg;
     }
     rex_file::delete($archivefile);
     if ($message) {
         $message = rex_i18n::msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
         $success = false;
     } else {
         $message = rex_i18n::msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="' . rex_url::backendPage('packages') . '">' . rex_i18n::msg('install_to_addon_page') . '</a>' : '');
         $success = true;
         unset($_REQUEST['addonkey']);
     }
     return new rex_api_result($success, $message);
 }
开发者ID:eaCe,项目名称:redaxo,代码行数:39,代码来源:api_package_download.php

示例5: execute

 public function execute()
 {
     global $I18N;
     $this->addonkey = rex_request('addonkey', 'string');
     $function = static::GET_PACKAGES_FUNCTION;
     $packages = rex_install_packages::$function();
     $this->fileId = rex_request('file', 'int');
     if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
         return null;
     }
     $this->file = $packages[$this->addonkey]['files'][$this->fileId];
     $this->checkPreConditions();
     $archivefile = rex_install_webservice::getArchive($this->file['path']);
     $message = '';
     $this->archive = $archivefile;
     if ($this->file['checksum'] != md5_file($archivefile)) {
         $message = $I18N->msg('install_warning_zip_wrong_checksum');
     } elseif (!file_exists("phar://{$archivefile}/" . $this->addonkey)) {
         $message = $I18N->msg('install_warning_zip_wrong_format');
     } elseif (is_string($msg = $this->doAction())) {
         $message = $msg;
     }
     rex_file::delete($archivefile);
     if ($message) {
         $message = $I18N->msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
         $success = false;
     } else {
         $message = $I18N->msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="index.php?page=addon">' . $I18N->msg('install_to_addon_page') . '</a>' : '');
         $success = true;
         unset($_REQUEST['addonkey']);
     }
     if ($success) {
         return $message;
     } else {
         throw new rex_install_functional_exception($message);
     }
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:37,代码来源:api_package_download.php

示例6: function

<?php

if (rex_string::versionCompare(rex::getVersion(), '5.0.0-beta1', '<=')) {
    rex_extension::register('RESPONSE_SHUTDOWN', function () {
        rex_file::delete(rex_path::assets('jquery.min.js'));
        rex_file::delete(rex_path::assets('jquery.min.map'));
        rex_file::delete(rex_path::assets('jquery-pjax.min.js'));
        rex_file::delete(rex_path::assets('jquery-ui.custom.min.js'));
        rex_file::delete(rex_path::assets('jquery-ui.custom.txt'));
        rex_file::delete(rex_path::assets('redaxo-logo.svg'));
        rex_file::delete(rex_path::assets('sha1.js'));
        rex_file::delete(rex_path::assets('standard.js'));
    });
    rex_dir::copy(__DIR__ . '/assets', rex_path::assets('core'));
    rex_dir::create(rex_path::data('core'));
    rename(rex_path::data('config.yml'), rex_path::data('core/config.yml'));
}
开发者ID:VIEWSION,项目名称:redaxo,代码行数:17,代码来源:update.php

示例7: rex_request

$goon = rex_request('goon', 'string');
$success = '';
$error = '';
$content = '';
$message = '';
if ($function == 'delete') {
    $del = rex_sql::factory();
    $del->setQuery('SELECT ' . rex::getTablePrefix() . 'article.id,' . rex::getTablePrefix() . 'template.name FROM ' . rex::getTablePrefix() . 'article
        LEFT JOIN ' . rex::getTablePrefix() . 'template ON ' . rex::getTablePrefix() . 'article.template_id=' . rex::getTablePrefix() . 'template.id
        WHERE ' . rex::getTablePrefix() . 'article.template_id="' . $template_id . '" LIMIT 0,10');
    if ($del->getRows() > 0 || rex_template::getDefaultId() == $template_id) {
        $error = rex_i18n::msg('cant_delete_template_because_its_in_use', rex_i18n::msg('id') . ' = ' . $template_id);
    } else {
        $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . 'template WHERE id = "' . $template_id . '" LIMIT 1');
        // max. ein Datensatz darf loeschbar sein
        rex_file::delete(rex_path::addonCache('templates', $template_id . '.template'));
        $success = rex_i18n::msg('template_deleted');
    }
} elseif ($function == 'edit') {
    $legend = rex_i18n::msg('edit_template') . ' <small class="rex-primary-id">' . rex_i18n::msg('id') . ' = ' . $template_id . '</small>';
    $hole = rex_sql::factory();
    $hole->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id = "' . $template_id . '"');
    if ($hole->getRows() == 1) {
        $templatename = $hole->getValue('name');
        $template = $hole->getValue('content');
        $active = $hole->getValue('active');
        $attributes = $hole->getArrayValue('attributes');
    } else {
        $function = '';
    }
} else {
开发者ID:DECAF,项目名称:redaxo,代码行数:31,代码来源:templates.php

示例8: rex_fragment

    echo $headline;
    $fragment = new rex_fragment();
    $fragment->setVar('title', rex_i18n::msg('setup_606'), false);
    $fragment->setVar('body', $content, false);
    $fragment->setVar('buttons', $buttons, false);
    $content = $fragment->parse('core/page/section.php');
    echo '<form class="rex-js-createadminform" action="' . rex_url::backendController() . '" method="post" autocomplete="off">' . $content . '</form>';
}
// ---------------------------------- step 7 . thank you . setup false
if ($step == 7) {
    $configFile = rex_path::data('config.yml');
    $config = array_merge(rex_file::getConfig(rex_path::core('default.config.yml')), rex_file::getConfig($configFile));
    $config['setup'] = false;
    if (rex_file::putConfig($configFile, $config)) {
        $errmsg = '';
        rex_file::delete(rex_path::cache('config.yml.cache'));
    } else {
        $errmsg = rex_i18n::msg('setup_701');
    }
    $headline = rex_view::title(rex_i18n::msg('setup_700'));
    $content = '<h3>' . rex_i18n::msg('setup_703') . '</h3>';
    $content .= rex_i18n::rawMsg('setup_704', '<a href="' . rex_url::backendController() . '">', '</a>');
    $content .= '<p>' . rex_i18n::msg('setup_705') . '</p>';
    $buttons = '<a class="btn btn-setup" href="' . rex_url::backendController() . '">' . rex_i18n::msg('setup_706') . '</a>';
    echo $headline;
    $fragment = new rex_fragment();
    $fragment->setVar('heading', rex_i18n::msg('setup_702'), false);
    $fragment->setVar('body', $content, false);
    $fragment->setVar('buttons', $buttons, false);
    echo $fragment->parse('core/page/section.php');
}
开发者ID:alsahh,项目名称:redaxo,代码行数:31,代码来源:setup.php

示例9: elseif

        } elseif ($exporttype == 'files') {
            // ------------------------------ FUNC EXPORT FILES
            $header = 'tar/gzip';
            if (empty($EXPDIR)) {
                $error = rex_i18n::msg('backup_please_choose_folder');
            } else {
                $content = rex_backup::exportFiles($EXPDIR);
                $hasContent = rex_file::put($export_path . $filename . $ext, $content);
            }
            // ------------------------------ /FUNC EXPORT FILES
        }
        if ($hasContent) {
            if ($exportdl) {
                $filename = $filename . $ext;
                rex_response::sendFile($export_path . $filename, $header, 'attachment');
                rex_file::delete($export_path . $filename);
                exit;
            } else {
                $success = rex_i18n::msg('backup_file_generated_in') . ' ' . strtr($filename . $ext, '\\', '/');
            }
        } else {
            $error = rex_i18n::msg('backup_file_could_not_be_generated') . ' ' . rex_i18n::msg('backup_check_rights_in_directory') . ' ' . $export_path;
        }
    }
}
if ($success != '') {
    echo rex_view::success($success);
}
if ($error != '') {
    echo rex_view::error($error);
}
开发者ID:DECAF,项目名称:redaxo,代码行数:31,代码来源:export.php

示例10: rex_deleteCacheMediaCategoryList

/**
 * Löscht die gecachte Media-Kategorien-Liste.
 *
 * @param $category_id Id der Media-Kategorie
 *
 * @return void
 */
function rex_deleteCacheMediaCategoryList($category_id)
{
    global $REX;
    $cachePath = $REX['GENERATED_PATH'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR;
    rex_file::delete($cachePath . $category_id . '.mclist');
}
开发者ID:eaCe,项目名称:redaxo4,代码行数:13,代码来源:function_rex_generate.inc.php

示例11: execute

 public function execute()
 {
     global $I18N;
     $this->addonkey = rex_request('addonkey', 'string');
     $function = static::GET_PACKAGES_FUNCTION;
     $packages = rex_install_packages::$function();
     $this->fileId = rex_request('file', 'int');
     if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
         return null;
     }
     $this->file = $packages[$this->addonkey]['files'][$this->fileId];
     $this->checkPreConditions();
     $archivefile = rex_install_webservice::getArchive($this->file['path']);
     $message = '';
     $this->archive = $archivefile;
     $checksum = md5_file($archivefile);
     if (class_exists("ZipArchive")) {
         $success = false;
         $zip = new ZipArchive();
         if ($zip->open($archivefile) === TRUE) {
             for ($i = 0; $i < $zip->numFiles; $i++) {
                 $filename = $zip->getNameIndex($i);
                 if (substr($filename, 0, strlen($this->addonkey . '/')) != $this->addonkey . '/') {
                     $zip->deleteIndex($i);
                 } else {
                     $success = true;
                 }
             }
             $zip->close();
         }
         if (!$success) {
             $message = $I18N->msg('install_warning_zip_wrong_format');
         }
     } else {
         if (!file_exists("phar://{$archivefile}/" . $this->addonkey)) {
             $message = $I18N->msg('install_warning_zip_wrong_format');
         }
     }
     if ($message != "") {
     } else {
         if ($this->file['checksum'] != $checksum) {
             $message = $I18N->msg('install_warning_zip_wrong_checksum');
         } else {
             if (is_string($msg = $this->doAction())) {
                 $message = $msg;
             }
         }
     }
     rex_file::delete($archivefile);
     if ($message) {
         $message = $I18N->msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
         $success = false;
     } else {
         $message = $I18N->msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="index.php?page=addon">' . $I18N->msg('install_to_addon_page') . '</a>' : '');
         $success = true;
         unset($_REQUEST['addonkey']);
     }
     if ($success) {
         return $message;
     } else {
         throw new rex_install_functional_exception($message);
     }
 }
开发者ID:redaxo,项目名称:redaxo4,代码行数:63,代码来源:api_package_download.php

示例12: execute


//.........这里部分代码省略.........
                 $addonPath = $dir->getRealPath() . '/';
                 if (!file_exists($addonPath . rex_package::FILE_PACKAGE)) {
                     continue;
                 }
                 $config = rex_file::getConfig($addonPath . rex_package::FILE_PACKAGE);
                 if (!isset($config['version']) || rex_addon::exists($addonkey) && rex_string::versionCompare($config['version'], rex_addon::get($addonkey)->getVersion(), '<')) {
                     continue;
                 }
                 $coreAddons[$addonkey] = $addonkey;
                 if (rex_addon::exists($addonkey)) {
                     $updateAddons[$addonkey] = rex_addon::get($addonkey);
                     $updateAddonsConfig[$addonkey] = $config;
                 }
             }
         }
         //$config = rex_file::getConfig($temppath . 'core/default.config.yml');
         //foreach ($config['system_addons'] as $addonkey) {
         //    if (is_dir($temppath . 'addons/' . $addonkey) && rex_addon::exists($addonkey)) {
         //        $updateAddons[$addonkey] = rex_addon::get($addonkey);
         //    }
         //}
         $this->checkRequirements($temppath, $version['version'], $updateAddonsConfig);
         if (file_exists($temppath . 'core/update.php')) {
             include $temppath . 'core/update.php';
         }
         foreach ($updateAddons as $addonkey => $addon) {
             if ($addon->isInstalled() && file_exists($file = $temppath . 'addons/' . $addonkey . '/' . rex_package::FILE_UPDATE)) {
                 try {
                     $addon->includeFile($file);
                     if ($msg = $addon->getProperty('updatemsg', '')) {
                         throw new rex_functional_exception($msg);
                     }
                     if (!$addon->getProperty('update', true)) {
                         throw new rex_functional_exception(rex_i18n::msg('package_no_reason'));
                     }
                 } catch (rex_functional_exception $e) {
                     throw new rex_functional_exception($addonkey . ': ' . $e->getMessage(), $e);
                 } catch (rex_sql_exception $e) {
                     throw new rex_functional_exception($addonkey . ': SQL error: ' . $e->getMessage(), $e);
                 }
             }
         }
         // create backup
         $installConfig = rex_file::getCache($installAddon->getDataPath('config.json'));
         if (isset($installConfig['backups']) && $installConfig['backups']) {
             rex_dir::create($installAddon->getDataPath());
             $archive = $installAddon->getDataPath(strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', rex::getVersion())) . '.zip');
             rex_install_archive::copyDirToArchive(rex_path::core(), $archive);
             foreach ($updateAddons as $addonkey => $addon) {
                 rex_install_archive::copyDirToArchive($addon->getPath(), $archive, 'addons/' . $addonkey);
             }
         }
         // copy plugins to new addon dirs
         foreach ($updateAddons as $addonkey => $addon) {
             foreach ($addon->getRegisteredPlugins() as $plugin) {
                 $pluginPath = $temppath . 'addons/' . $addonkey . '/plugins/' . $plugin->getName();
                 if (!is_dir($pluginPath)) {
                     rex_dir::copy($plugin->getPath(), $pluginPath);
                 } elseif ($plugin->isInstalled() && is_dir($pluginPath . '/assets')) {
                     rex_dir::copy($pluginPath . '/assets', $plugin->getAssetsPath());
                 }
             }
         }
         // move temp dirs to permanent destination
         rex_dir::delete(rex_path::core());
         rename($temppath . 'core', rex_path::core());
         if (is_dir(rex_path::core('assets'))) {
             rex_dir::copy(rex_path::core('assets'), rex_path::coreAssets());
         }
         foreach ($coreAddons as $addonkey) {
             if (isset($updateAddons[$addonkey])) {
                 rex_dir::delete(rex_path::addon($addonkey));
             }
             rename($temppath . 'addons/' . $addonkey, rex_path::addon($addonkey));
             if (is_dir(rex_path::addon($addonkey, 'assets'))) {
                 rex_dir::copy(rex_path::addon($addonkey, 'assets'), rex_path::addonAssets($addonkey));
             }
         }
     } catch (rex_functional_exception $e) {
         $message = $e->getMessage();
     } catch (rex_sql_exception $e) {
         $message = 'SQL error: ' . $e->getMessage();
     }
     rex_file::delete($archivefile);
     rex_dir::delete($temppath);
     if ($message) {
         $message = $installAddon->i18n('warning_core_not_updated') . '<br />' . $message;
         $success = false;
     } else {
         $message = $installAddon->i18n('info_core_updated');
         $success = true;
         rex_delete_cache();
         rex_install_webservice::deleteCache('core');
     }
     $result = new rex_api_result($success, $message);
     if ($success) {
         $result->setRequiresReboot(true);
     }
     return $result;
 }
开发者ID:VIEWSION,项目名称:redaxo,代码行数:101,代码来源:api_core_update.php

示例13: save

 /**
  * persists the config-data and truncates the file-cache.
  */
 public static function save()
 {
     // save cache only if changes happened
     if (!self::$changed) {
         return;
     }
     // after all no data needs to be deleted or update, so skip save
     if (empty(self::$deletedData) && empty(self::$changedData)) {
         return;
     }
     // delete cache-file; will be regenerated on next request
     rex_file::delete(REX_CONFIG_FILE_CACHE);
     // save all data to the db
     self::saveToDb();
     self::$changed = false;
 }
开发者ID:VIEWSION,项目名称:redaxo,代码行数:19,代码来源:config.php

示例14: deleteIterator

 /**
  * Deletes files and directories by a rex_dir_iterator
  *
  * @param Traversable $iterator Iterator, $iterator->current() must return a SplFileInfo-Object
  * @return boolean TRUE on success, FALSE on failure
  */
 public static function deleteIterator(Traversable $iterator)
 {
     $state = true;
     foreach ($iterator as $file) {
         if ($file->isDir()) {
             $state = rmdir($file) && $state;
         } else {
             $state = rex_file::delete($file) && $state;
         }
     }
     return $state;
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:18,代码来源:dir.php

示例15: testDelete

 public function testDelete()
 {
     $file = $this->getPath('delete.txt');
     rex_file::put($file, '');
     $this->assertTrue(file_exists($file), 'file exists after put()');
     $this->assertTrue(rex_file::delete($file), 'delete() returns true on success');
     $this->assertFalse(file_exists($file), 'file does not exist after delete()');
     $this->assertTrue(rex_file::delete($file), 'delete() returns true when the file is already deleted');
 }
开发者ID:staabm,项目名称:redaxo,代码行数:9,代码来源:file_test.php


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