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


PHP JFile::delete方法代码示例

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


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

示例1: com_uninstall

function com_uninstall()
{
    require_once JPATH_ROOT . '/components/com_community/defines.community.php';
    $asset = JTable::getInstance('Asset');
    if ($asset->loadByName('com_community')) {
        $asset->delete();
    }
    $db = JFactory::getDBO();
    // Remove jomsocialuser plugin during uninstall to prevent error
    // during login/logout of Joomla.
    $query = 'DELETE FROM ' . $db->quoteName(PLUGIN_TABLE_NAME) . ' ' . 'WHERE ' . $db->quoteName('element') . '=' . $db->quote('jomsocialuser') . ' AND ' . $db->quoteName('folder') . '=' . $db->quote('user');
    $db->setQuery($query);
    $db->query();
    $pluginPath = JPATH_ROOT . '/plugins/user/jomsocialuser/';
    if (JFile::exists($pluginPath . 'jomsocialuser.php')) {
        JFile::delete($pluginPath . 'jomsocialuser.php');
    }
    if (JFile::exists($pluginPath . 'jomsocialuser.xml')) {
        JFile::delete($pluginPath . 'jomsocialuser.xml');
    }
    removeBackupTemplate('blueface');
    removeBackupTemplate('bubble');
    removeBackupTemplate('blackout');
    return true;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:25,代码来源:uninstall.community.php

示例2: deleteHelpManifest

 private function deleteHelpManifest($parent)
 {
     jimport('joomla.filesystem.file');
     $installer = $parent->getParent();
     $manifestFile = basename($installer->getPath('manifest'));
     JFile::delete(JPATH_ROOT . '/modules/mod_ariextmenu/' . $manifestFile);
 }
开发者ID:emisdb,项目名称:elyii,代码行数:7,代码来源:script.php

示例3: setImage

 public function setImage($path, $type = 'thumb')
 {
     CError::assert($path, '', '!empty', __FILE__, __LINE__);
     $db = $this->getDBO();
     // Fix the back quotes
     $path = CString::str_ireplace('\\', '/', $path);
     $type = JString::strtolower($type);
     // Test if the record exists.
     $oldFile = $this->{$type};
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     if ($oldFile) {
         // File exists, try to remove old files first.
         $oldFile = CString::str_ireplace('/', '/', $oldFile);
         // If old file is default_thumb or default, we should not remove it.
         //
         // Need proper way to test it
         if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) {
             jimport('joomla.filesystem.file');
             JFile::delete($oldFile);
         }
     }
     $this->{$type} = $path;
     $this->store();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:26,代码来源:moods.php

示例4: clear

 /**
  * Clear cache
  * @param $group
  */
 public function clear($group)
 {
     $file = JPATH_SITE . '/cache/jbzoo/' . $group;
     if (JFile::exists($file)) {
         JFile::delete($file);
     }
 }
开发者ID:alexmixaylov,项目名称:real,代码行数:11,代码来源:jbcache.php

示例5: _removeObsoleteFilesAndFolders

 private function _removeObsoleteFilesAndFolders($icagendaRemoveFiles)
 {
     // Remove files
     jimport('joomla.filesystem.file');
     if (!empty($icagendaRemoveFiles['files'])) {
         foreach ($icagendaRemoveFiles['files'] as $file) {
             $f = JPATH_ROOT . '/' . $file;
             if (!JFile::exists($f)) {
                 continue;
             }
             JFile::delete($f);
         }
     }
     // Remove folders
     jimport('joomla.filesystem.file');
     if (!empty($icagendaRemoveFiles['folders'])) {
         foreach ($icagendaRemoveFiles['folders'] as $folder) {
             $f = JPATH_ROOT . '/' . $folder;
             if (!JFolder::exists($f)) {
                 continue;
             }
             JFolder::delete($f);
         }
     }
 }
开发者ID:richardgarcia7,项目名称:apc-softdev-gd121mi122-06,代码行数:25,代码来源:script.icagenda.php

示例6: display

 public function display($tpl = null)
 {
     $model = $this->getModel();
     $xmlContent = $model->backupAssets();
     $sqlContent = $model->backupSql();
     $version = JFactory::getDate()->toUnix();
     $xmlFilePath = JFactory::getConfig()->get('tmp_path') . '/' . 'xml-' . $version . '.xml';
     $sqlFilePath = JFactory::getConfig()->get('tmp_path') . '/' . 'sql-' . $version . '.sql';
     JFile::write($xmlFilePath, $xmlContent);
     JFile::write($sqlFilePath, $sqlContent);
     $fileDownloadName = 'solidres' . $version . '.zip';
     SRFactory::get('solidres.utilities.ziparchive')->zipFiles(array($xmlFilePath, $sqlFilePath), JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName);
     JFile::delete($xmlFilePath);
     JFile::delete($sqlFilePath);
     //make file to download
     header('Content-Type: application/zip');
     header('Content-Disposition: attachment; filename="' . $fileDownloadName);
     header("Content-Transfer-Encoding: binary");
     header('Accept-Ranges: bytes');
     header("Cache-control: private");
     header('Pragma: private');
     header("Expires: " . JFactory::getDate()->toSql());
     header("Content-Length: " . filesize(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName));
     ob_clean();
     flush();
     readfile(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName);
     JFile::delete(JFactory::getConfig()->get('tmp_path') . '/' . $fileDownloadName);
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:28,代码来源:view.file.php

示例7: __construct

 function __construct($parent)
 {
     if ($parent->API->get('recompile_css', 0) == 1) {
         // remove old Template CSS files
         jimport('joomla.filesystem.file');
         JFile::delete($parent->API->URLtemplatepath() . '/css/global.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/default.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/print.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/mail.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/error.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/offline.css');
         JFile::delete($parent->API->URLtemplatepath() . '/css/override.css');
         // generate new Template CSS files
         try {
             // normal Template code
             $less = new DSCTemplateHelperLessc();
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/global.less', $parent->API->URLtemplatepath() . '/css/global.css');
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/default.less', $parent->API->URLtemplatepath() . '/css/default.css');
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/print.less', $parent->API->URLtemplatepath() . '/css/print.css');
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/mail.less', $parent->API->URLtemplatepath() . '/css/mail.css');
             // additional Template code
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/error.less', $parent->API->URLtemplatepath() . '/css/error.css');
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/offline.less', $parent->API->URLtemplatepath() . '/css/offline.css');
             $less->checkedCompile($parent->API->URLtemplatepath() . '/less/override.less', $parent->API->URLtemplatepath() . '/css/override.css');
         } catch (exception $ex) {
             exit('LESS Parser fatal error:<br />' . $ex->getMessage());
         }
     }
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:29,代码来源:less.php

示例8: doExecute

 /**
  * Execute the application.
  *
  * @throws Exception
  *
  * @return void
  */
 public function doExecute()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $this->out();
     $this->out('EasyCreator BuildHelper');
     $this->out('=======================');
     $this->out();
     $dir = $this->input->get('dir', false, 'string');
     $ecrBase = $dir . '/admin';
     $this->out('Base: ' . $ecrBase);
     $folders = array('data/builds', 'data/deploy', 'data/exports', 'data/logs', 'data/results', 'data/projects', 'data/sync', 'tests');
     $cntAll = 0;
     foreach ($folders as $folder) {
         $cnt = 0;
         if (false == JFolder::exists($ecrBase . '/' . $folder)) {
             continue;
         }
         $files = JFolder::files($ecrBase . '/' . $folder, '.', true, true, array('readme.md'));
         foreach ($files as $file) {
             if (false == JFile::delete($file)) {
                 throw new Exception('Can not delete file: ' . $file, 2);
             }
             $cnt++;
         }
         $cntAll += $cnt;
         $this->out(sprintf('%4d EasyCreator files have been deleted in %s', $cnt, $folder));
     }
     $this->out(sprintf('%4d files total', $cntAll));
 }
开发者ID:aminodrago,项目名称:EasyCreator,代码行数:37,代码来源:buildhelper.php

示例9: postflight

 /**
  * Method to run after installing the component
  */
 function postflight($type, $parent)
 {
     //Restore the modified language strings by merging to language files
     $registry = new JRegistry();
     foreach (self::$languageFiles as $languageFile) {
         $backupFile = JPATH_ROOT . '/language/en-GB/bak.' . $languageFile;
         $currentFile = JPATH_ROOT . '/language/en-GB/' . $languageFile;
         if (JFile::exists($currentFile) && JFile::exists($backupFile)) {
             $registry->loadFile($currentFile, 'INI');
             $currentItems = $registry->toArray();
             $registry->loadFile($backupFile, 'INI');
             $backupItems = $registry->toArray();
             $items = array_merge($currentItems, $backupItems);
             $content = "";
             foreach ($items as $key => $value) {
                 $content .= "{$key}=\"{$value}\"\n";
             }
             JFile::write($currentFile, $content);
         }
     }
     // Restore custom modified css file
     if (JFile::exists(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css')) {
         JFile::copy(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css', JPATH_ROOT . '/components/com_osmembership/assets/css/custom.css');
         JFile::delete(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css');
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:29,代码来源:install.osmembership.php

示例10: uninstall

 public function uninstall($adapter)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // Delete plugin files
     $folder = JPATH_PLUGINS . '/system/' . $this->_ext;
     if (JFolder::exists($folder)) {
         JFolder::delete($folder);
     }
     // Delete plugin language files
     $lang_folder = JPATH_ADMINISTRATOR . '/language';
     $languages = JFolder::folders($lang_folder);
     foreach ($languages as $lang) {
         $file = $lang_folder . '/' . $lang . '/' . $lang . '.plg_system_' . $this->_ext . '.ini';
         if (JFile::exists($file)) {
             JFile::delete($file);
         }
         $file = $lang_folder . '/' . $lang . '/' . $lang . '.plg_system_' . $this->_ext . '.sys.ini';
         if (JFile::exists($file)) {
             JFile::delete($file);
         }
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->delete('#__extensions')->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))->where($db->quoteName('element') . ' = ' . $db->quote($this->_ext));
     $db->setQuery($query);
     $db->execute();
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:script.advancedmodules.php

示例11: delete_anunt

function delete_anunt($id, $uid)
{
    $db = JFactory::getDbo();
    jimport('joomla.filesystem.file');
    $query = "SELECT * FROM #__sa_poze WHERE `id_anunt` = '" . $id . "'";
    $db->setQuery($query);
    $pics = $db->loadObjectList();
    $path = JPATH_ROOT . DS . 'components' . DS . 'com_sauto' . DS . 'assets' . DS . 'users' . DS . $uid . DS;
    foreach ($pics as $p) {
        echo '>>>> ' . $p->poza . '<br />';
        //delete fisier
        $path_delete = $path . $p->poza;
        JFile::delete($path_delete);
        //delete from db
        $query = "DELETE FROM #__sa_poze WHERE `id` = '" . $p->id . "'";
        $db->setQuery($query);
        $db->query();
    }
    //delete anunt
    $query = "DELETE FROM #__sa_anunturi WHERE `id` = '" . $id . "'";
    $db->setQuery($query);
    $db->query();
    $app =& JFactory::getApplication();
    $link_ok = JRoute::_('index.php?option=com_sauto&view=my_request');
    $app->redirect($link_ok, JText::_('SAUTO_ANUNT_STERS_CU_SUCCES'));
}
开发者ID:grchis,项目名称:Site-Auto,代码行数:26,代码来源:default.php

示例12: upload

 /**
  * Support Zip files for image galleries 
  * @see TiendaFile::upload()
  */
 function upload()
 {
     if ($result = parent::upload()) {
         // Check if it's a supported archive
         $allowed_archives = array('zip', 'tar', 'tgz', 'gz', 'gzip', 'tbz2', 'bz2', 'bzip2');
         if (in_array(strtolower($this->getExtension()), $allowed_archives)) {
             $dir = $this->getDirectory();
             jimport('joomla.filesystem.archive');
             JArchive::extract($this->full_path, $dir);
             JFile::delete($this->full_path);
             $this->is_archive = true;
             $files = JFolder::files($dir);
             // Thumbnails support
             if (count($files)) {
                 // Name correction
                 foreach ($files as &$file) {
                     $file = new TiendaImage($dir . '/' . $file);
                 }
                 $this->archive_files = $files;
                 $this->physicalname = $files[0]->getPhysicalname();
             }
         }
     }
     return $result;
 }
开发者ID:annggeel,项目名称:tienda,代码行数:29,代码来源:image.php

示例13: delete

 /**
  * Delete the files, and removes them from filesystem table, marks them in the log as 'deleted'
  * Note that processed items are removed from buffer
  * @return int|boolean number of deleted files, FALSE on error
  */
 function delete()
 {
     $count = 0;
     if (!empty($this->_deleteLogs)) {
         list($files, $ids) = $this->_getFilesAndIds($this->_deleteLogs);
         foreach ($files as $file) {
             if (JFile::exists($file)) {
                 if (!JFile::delete($file)) {
                     $this->setError(JText::_('Cannot delete file') . ': ' . $file);
                     $this->_deleteLogs = array();
                     return false;
                 }
                 $count++;
             }
         }
         if (count($ids)) {
             $this->setLogStatus($ids, 'deleted');
         }
         $this->removeFromFilesystemTable($files);
         $this->setLogStatus($ids, 'deleted');
     }
     // Empty the buffer
     $this->_deleteLogs = array();
     return true;
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:30,代码来源:jd_abstractfileaction.php

示例14: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     // make sure ZOO exist
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     $this->app = App::getInstance('zoo');
     // Load from cache
     require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/cparams.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/download.php';
     $username = ZLManagerHelperCparams::getParam('username', '');
     $password = ZLManagerHelperCparams::getParam('password', '');
     $key = md5($username . ':' . $password);
     $cache = $this->getCache($key);
     if (!$cache || !($json = $cache->get('json'))) {
         $url = 'https://www.zoolanders.com/index.php?option=com_zoo&controller=zooextensions&task=getList&format=raw&username=' . $username . '&password=' . $password;
         $file = JPATH_SITE . '/tmp/zlmanager.json';
         ZLManagerDownloadHelper::download($url, $file);
         $json = JFile::read($file);
         JFile::delete($file);
         if ($cache) {
             $cache->set('json', $json)->save();
         }
     }
     $this->_json = json_decode($json);
     $this->setState('limit', 50);
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:31,代码来源:extensions.php

示例15: delete

 public function delete()
 {
     /*
      * получаем имя файла из записи по ID
      * удаляем файл
      * выполняем родительский метод
      */
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (is_array($cid) && count($cid) > 0) {
         $arFilesToDelete = array();
         foreach ($cid as $id) {
             $db = JFactory::getDBO();
             $q = "SELECT `id`, `filename` FROM #__downfiles WHERE id = {$id}";
             $res = $db->setQuery($q);
             $data_row = $res->loadAssoc();
             $arFilesToDelete[] = $data_row["filename"];
         }
         jimport('joomla.filesystem.file');
         foreach ($arFilesToDelete as $fname) {
             JFile::delete(JPATH_ROOT . '/' . $fname);
         }
     } else {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     }
     parent::delete();
 }
开发者ID:matth-oz,项目名称:com_downfiles,代码行数:26,代码来源:downfiles.php


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