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


PHP waFiles::delete方法代码示例

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


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

示例1: execute

 function execute()
 {
     try {
         $message = array();
         $settings = waRequest::get('setting');
         if ($settings) {
             $model = new waAppSettingsModel();
             $changed = false;
             foreach ((array) $settings as $setting) {
                 if (in_array($setting, array('auth_form_background'))) {
                     if ($value = $model->get('webasyst', $setting)) {
                         waFiles::delete(wa()->getDataPath($value, true, 'webasyst'));
                         $message[] = _w('Image deleted');
                     }
                 } else {
                     $changed = true;
                 }
                 $model->set('webasyst', $setting, false);
             }
             if ($changed) {
                 $message[] = _w('Settings saved');
             }
         }
         $params = array('module' => 'settings', 'msg' => installerMessage::getInstance()->raiseMessage(implode(', ', $message)));
         $this->redirect($params);
     } catch (waException $ex) {
         $msg = installerMessage::getInstance()->raiseMessage($ex->getMessage(), installerMessage::R_FAIL);
         $params = array('module' => 'settings', 'msg' => $msg);
         $this->redirect($params);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:31,代码来源:installerSettingsRemove.action.php

示例2: execute

 public function execute()
 {
     $p = $path = rtrim(waRequest::post('path'), ' /');
     $file = waRequest::post('file');
     try {
         if ($file) {
             if (!is_array($file)) {
                 $file = array($file);
             }
             foreach ($file as $f) {
                 $f = $path . '/' . $f;
                 waFiles::delete(wa()->getDataPath($f, true, null, false));
             }
             $this->log('file_delete', count($file));
         } else {
             $path = wa()->getDataPath($path, true, null, false);
             if (!is_writable($path)) {
                 $this->errors = sprintf(_w("Folder could not bet deleted due to the insufficient permissions."), $p);
             } else {
                 waFiles::delete($path);
                 $this->log('file_delete', 1);
             }
         }
     } catch (Exception $e) {
         $this->errors = $e->getMessage();
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:siteFilesDelete.controller.php

示例3: step

 protected function step()
 {
     $image_model = new shopProductImagesModel();
     $create_thumbnails = waRequest::post('create_thumbnails');
     $chunk_size = 50;
     if ($create_thumbnails) {
         $chunk_size = 10;
     }
     $sizes = wa('shop')->getConfig()->getImageSizes();
     $images = $image_model->getAvailableImages($this->data['offset'], $chunk_size);
     foreach ($images as $i) {
         if ($this->data['product_id'] != $i['product_id']) {
             sleep(0.2);
             $this->data['product_id'] = $i['product_id'];
             $this->data['product_count'] += 1;
         }
         try {
             $path = shopImage::getThumbsPath($i);
             if (!waFiles::delete($path)) {
                 throw new waException(sprintf(_w('Error when delete thumbnails for image %d'), $i['id']));
             }
             if ($create_thumbnails) {
                 shopImage::generateThumbs($i, $sizes);
             }
             $this->data['image_count'] += 1;
             // image count - count of successful progessed images
         } catch (Exception $e) {
             $this->error($e->getMessage());
         }
         $this->data['offset'] += 1;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:32,代码来源:shopSettingsImagesRegenerate.controller.php

示例4: flushCache

 protected function flushCache()
 {
     $config = wa()->getConfig();
     $path_cache = $config->getPath('cache');
     waFiles::protect($path_cache);
     $caches = array();
     $paths = waFiles::listdir($path_cache);
     foreach ($paths as $path) {
         #skip long action & data path
         if ($path != 'temp') {
             $path = $path_cache . '/' . $path;
             if (is_dir($path)) {
                 $caches[] = $path;
             }
         }
     }
     $root_path = $config->getRootPath();
     $errors = array();
     foreach ($caches as $path) {
         try {
             waFiles::delete($path);
         } catch (Exception $ex) {
             $errors[] = str_replace($root_path . DIRECTORY_SEPARATOR, '', $ex->getMessage());
             waFiles::delete($path, true);
         }
     }
     waFiles::protect($path_cache);
     return $errors;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:29,代码来源:webasystCreateCliController.class.php

示例5: removeExtras

 protected function removeExtras($app_id, $extras_id, $info)
 {
     try {
         $paths = array();
         $plugin_instance = waSystem::getInstance($app_id)->getPlugin($extras_id);
         if (!$plugin_instance) {
             return false;
         }
         $plugin_instance->uninstall();
         $this->installer->updateAppPluginsConfig($app_id, $extras_id, null);
         //wa-apps/$app_id/plugins/$slug
         $paths[] = wa()->getAppPath("{$this->extras_type}/{$extras_id}", $app_id);
         $paths[] = wa()->getTempPath(null, $app_id);
         //wa-cache/temp/$app_id/
         $paths[] = wa()->getAppCachePath(null, $app_id);
         //wa-cache/apps/$app_id/
         foreach ($paths as $path) {
             waFiles::delete($path, true);
         }
         return true;
     } catch (Exception $ex) {
         //TODO check config
         $this->installer->updateAppPluginsConfig($app_id, $extras_id, true);
         throw $ex;
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:26,代码来源:installerPluginsRemove.action.php

示例6: delete

 public static function delete($file)
 {
     self::loadPath();
     $file = preg_replace('!\\.\\.[/\\\\]!', '', $file);
     $file = self::$path . $file;
     if (file_exists($file)) {
         waFiles::delete($file);
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:9,代码来源:waLog.class.php

示例7: execute

 public function execute()
 {
     $contact = wa()->getUser();
     $contact['photo'] = 0;
     $contact->save();
     $oldDir = wa()->getDataPath(waContact::getPhotoDir($contact->getId()), true, 'contacts', false);
     if (file_exists($oldDir)) {
         waFiles::delete($oldDir);
     }
     $this->response = array('done' => 1);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:11,代码来源:webasystProfileDeletePhoto.controller.php

示例8: execute

 public function execute()
 {
     $id = waRequest::post('id');
     if (is_numeric($id)) {
         $modelNotifierTemplate = new shopNotifierTemplateModel();
         $path = shopNotifierPlugin::path($id);
         waFiles::delete($path);
         $modelNotifierTemplate->deleteById($id);
         $this->response['message'] = 'ok';
     } else {
         $this->response['message'] = 'fail';
     }
 }
开发者ID:quadrodesign,项目名称:notifier,代码行数:13,代码来源:shopNotifierPluginSettingsDeletetemplate.controller.php

示例9: removeExtras

 protected function removeExtras($app_id, $extras_id, $info)
 {
     $paths = array();
     $paths[] = wa()->getTempPath(null, $app_id);
     //wa-cache/temp/$app_id/
     //wa-apps/$app_id/extrass/$slug
     $paths[] = wa()->getAppPath("{$this->extras_type}/{$extras_id}", $app_id);
     $paths[] = wa()->getAppCachePath(null, $app_id);
     //wa-cache/apps/$app_id/
     foreach ($paths as $path) {
         waFiles::delete($path, true);
     }
     return true;
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:14,代码来源:installerThemesRemove.action.php

示例10: execute

 public function execute()
 {
     $id = $this->getId();
     // Delete the old photos if they exist
     $oldDir = wa()->getDataPath(waContact::getPhotoDir($id), TRUE);
     if (file_exists($oldDir)) {
         waFiles::delete($oldDir);
     }
     // Update record in DB for this user
     $contact = new waContact($id);
     $contact['photo'] = 0;
     $contact->save();
     // Update recent history to reload thumbnail correctly (if not called from personal account)
     if (wa()->getUser()->get('is_user')) {
         $history = new contactsHistoryModel();
         $history->save('/contact/' . $id, null, null, '--');
     }
     $this->response = array('done' => 1, 'url' => $contact->getPhoto());
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:19,代码来源:contactsPhotoDelete.controller.php

示例11: removeExtras

 protected function removeExtras($app_id, $extras_id)
 {
     try {
         $paths = array();
         if (strpos($app_id, 'wa-plugins/') !== 0) {
             try {
                 $plugin_instance = waSystem::getInstance($app_id)->getPlugin($extras_id);
                 if (!$plugin_instance) {
                     return false;
                 }
                 $plugin_instance->uninstall();
             } catch (Exception $ex) {
                 waLog::log($ex->getMessage(), 'installer.log');
             }
             $this->installer->updateAppPluginsConfig($app_id, $extras_id, null);
             //wa-apps/$app_id/plugins/$slug
             $paths[] = wa()->getAppPath("{$this->extras_type}/{$extras_id}", $app_id);
             $paths[] = wa()->getTempPath(null, $app_id);
             //wa-cache/temp/$app_id/
             $paths[] = wa()->getAppCachePath(null, $app_id);
             //wa-cache/apps/$app_id/
         } else {
             $type = str_replace('wa-plugins/', '', $app_id);
             $paths[] = wa()->getConfig()->getPath('plugins') . '/' . $type . '/' . $extras_id;
             //wa-plugins/$type/$extras_id
             $paths[] = wa()->getAppCachePath(null, $type . '_' . $extras_id);
             //wa-cache/apps/$app_id/
         }
         foreach ($paths as $path) {
             waFiles::delete($path, true);
         }
         return true;
     } catch (Exception $ex) {
         //TODO check config
         if (strpos($app_id, 'wa-plugins/') !== 0) {
             if (file_exists(reset($paths) . '/lib/plugin.php')) {
                 $this->installer->updateAppPluginsConfig($app_id, $extras_id, true);
             }
         }
         throw $ex;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:42,代码来源:installerPluginsRemove.action.php

示例12: delete

 public function delete(array $product_ids)
 {
     if (wa()->getEnv() !== 'cli') {
         $delete_ids = $this->filterAllowedProductIds($product_ids);
     } else {
         $delete_ids = $product_ids;
     }
     // remove files
     foreach ($delete_ids as $product_id) {
         try {
             waFiles::delete(shopProduct::getPath($product_id, null, false));
             waFiles::delete(shopProduct::getPath($product_id, null, true));
         } catch (waException $e) {
         }
     }
     if (empty($delete_ids)) {
         return false;
     }
     $params = array('ids' => $delete_ids);
     /**
      * @event product_delete
      * @param array [string]mixed $params
      * @param array [string]array $params['ids'] Array of IDs of deleted product entries
      * @return void
      */
     wa()->event('product_delete', $params);
     // remove from related models
     foreach (array(new shopProductFeaturesModel(), new shopProductImagesModel(), new shopProductReviewsModel(), new shopProductServicesModel(), new shopProductSkusModel(), new shopProductStocksModel(), new shopProductStocksLogModel(), new shopProductTagsModel(), new shopCategoryProductsModel(), new shopSetProductsModel(), new shopSearchIndexModel(), new shopProductFeaturesSelectableModel(), new shopProductParamsModel(), new shopCartItemsModel()) as $model) {
         $model->deleteByProducts($delete_ids);
     }
     $type_ids = $this->select('DISTINCT `type_id`')->where($this->getWhereByField($this->id, $delete_ids))->fetchAll('type_id');
     // remove records
     if ($this->deleteById($delete_ids)) {
         $type_model = new shopTypeModel();
         $type_model->recount(array_keys($type_ids));
         if ($cache = wa('shop')->getCache()) {
             $cache->deleteGroup('sets');
         }
         return $delete_ids;
     }
     return false;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:42,代码来源:shopProduct.model.php

示例13: execute

 public function execute()
 {
     try {
         $path_cache = waConfig::get('wa_path_cache');
         waFiles::delete($path_cache, true);
         waFiles::protect($path_cache);
         $app_path = waConfig::get('wa_path_apps');
         $apps = new waInstallerApps();
         $app_list = $apps->getApplicationsList(true);
         foreach ($app_list as $app) {
             if (isset($app['enabled']) && $app['enabled']) {
                 $path_cache = $app_path . '/' . $app['slug'] . '/js/compiled';
                 waFiles::delete($path_cache, true);
             }
         }
         $this->response['message'] = _w('Cache cleared');
     } catch (Exception $ex) {
         $this->setError($ex->getMessage());
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:20,代码来源:installerSettingsClearCache.controller.php

示例14: execute

 public function execute()
 {
     $deleted = false;
     if ($this->getRights('delete_files')) {
         $path = waRequest::post('path');
         if ($path) {
             $full_path = logsHelper::getAbsolutePath($path);
             if (!is_dir($full_path)) {
                 $available = logsHelper::checkPath($full_path, false);
                 if ($available) {
                     $deleted = waFiles::delete($full_path);
                 }
             }
         }
     }
     if ($deleted) {
         $update_total_size = waRequest::get('update_size', 0, waRequest::TYPE_INT) == 1;
         $this->response['total_size'] = $update_total_size ? logsHelper::getTotalLogsSize() : '';
     } else {
         $this->errors[] = _wp('File cannot be deleted');
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:22,代码来源:logsBackendDelete.controller.php

示例15: execute

 public function execute()
 {
     $id = waRequest::post('id', null, waRequest::TYPE_INT);
     $filter = waRequest::post('filter', 'grayscale', waRequest::TYPE_STRING_TRIM);
     if (!$id) {
         throw new waException(_w("Can't apply a filter to photo: unknown photo id"));
     }
     if (!isset($this->filters[$filter])) {
         throw new waException(_w("Can't apply a filter to photo: unknown filter"));
     }
     $plugin = wa('photos')->getPlugin('imageeffects');
     $filter_params = $plugin->getSettings($filter);
     $filter_params = $filter_params ? $filter_params : array();
     $filter = $this->filters[$filter];
     $photo_model = new photosPhotoModel();
     $photo_rights_model = new photosPhotoRightsModel();
     $photo = $photo_model->getById($id);
     $photo_rights_model = new photosPhotoRightsModel();
     if (!$photo_rights_model->checkRights($photo, true)) {
         throw new waException(_w("You don't have sufficient access rights"));
     }
     $photo_path = photosPhoto::getPhotoPath($photo);
     $image = new photosImage($photo_path);
     if ($image->filter($filter, $filter_params)->save()) {
         waFiles::delete(photosPhoto::getPhotoThumbDir($photo));
         $edit_datetime = date('Y-m-d H:i:s');
         $photo_model->updateById($id, array('edit_datetime' => $edit_datetime));
         $photo['edit_datetime'] = $edit_datetime;
         $original_photo_path = photosPhoto::getOriginalPhotoPath($photo);
         if (wa('photos')->getConfig()->getOption('save_original') && file_exists($original_photo_path)) {
             $photo['original_exists'] = true;
         } else {
             $photo['original_exists'] = false;
         }
         $this->response['photo'] = $photo;
         $this->log('photo_edit', 1);
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:38,代码来源:photosImageeffectsPluginBackend.controller.php


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