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


PHP General::deleteFile方法代码示例

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


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

示例1: delete

 public function delete($id)
 {
     $file = TEXTFORMATTERS . '/formatter.' . $id . '.php';
     if (!General::deleteFile($file)) {
         $this->pageAlert(__('Failed to delete <code>%s</code>. Please check permissions.', array($file)), Alert::ERROR);
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:7,代码来源:content.index.php

示例2: __clearSubsectionCache

 /**
  * Clear cache.
  *
  * @see http://symphony-cms.com/learn/api/2.3/delegates/#DatasourcePreDelete
  */
 public function __clearSubsectionCache()
 {
     if (file_exists(CACHE . '/subsectionmanager-storage')) {
         General::deleteFile(CACHE . '/subsectionmanager-storage');
     }
     self::$updateCache = true;
 }
开发者ID:symphonists,项目名称:subsectionmanager,代码行数:12,代码来源:extension.driver.php

示例3: action

 function action()
 {
     $checked = @array_keys($_POST['items']);
     if (!isset($_POST['action']['apply']) || empty($checked)) {
         return;
     }
     $FileManager =& $this->_Parent->ExtensionManager->create('filemanager');
     switch ($_POST['with-selected']) {
         case 'delete':
             $path = DOCROOT . $FileManager->getStartLocation();
             foreach ($checked as $rel_file) {
                 $abs_file = $path . '/' . ltrim($rel_file, '/');
                 if (!is_dir($abs_file) && file_exists($abs_file)) {
                     General::deleteFile($abs_file);
                 } elseif (is_dir($abs_file)) {
                     if (!@rmdir($abs_file)) {
                         $this->pageAlert(__('%s could not be deleted as is still contains files.', array('<code>' . $rel_file . '</code>')), AdministrationPage::PAGE_ALERT_ERROR);
                     }
                 }
             }
             break;
         case 'archive':
             $path = is_array($this->_context) && !empty($this->_context) ? '/' . implode('/', $this->_context) . '/' : NULL;
             $filename = $FileManager->createArchive($checked, $path);
             break;
     }
 }
开发者ID:andrrr,项目名称:filemanager,代码行数:27,代码来源:content.browse.php

示例4: __actionIndex

 function __actionIndex()
 {
     $checked = @array_keys($_POST['items']);
     if (is_array($checked) && !empty($checked)) {
         switch ($_POST['with-selected']) {
             case 'delete':
                 $pages = $checked;
                 ## TODO: Fix Me
                 ###
                 # Delegate: Delete
                 # Description: Prior to deletion. Provided with an array of pages for deletion that can be modified.
                 //$ExtensionManager->notifyMembers('Delete', getCurrentPage(), array('pages' => &$pages));
                 $pagesList = join(', ', array_map('intval', $pages));
                 // 1. Fetch page details
                 $query = 'SELECT `id`, `sortorder`, `handle`, `path`, `title` FROM tbl_pages_templates WHERE `id` IN (' . $pagesList . ')';
                 $details = $this->_Parent->Database->fetch($query);
                 $this->_Parent->Database->delete('tbl_pages_templates', " `id` IN('" . implode("','", $checked) . "')");
                 $this->_Parent->Database->delete('tbl_pages_types', " `page_id` IN('" . implode("','", $checked) . "')");
                 foreach ($details as $r) {
                     $filename = Lang::createHandle($r['title']);
                     // echo PAGES . "/templates/" . $filename . ".xsl";
                     $this->_Parent->Database->query("UPDATE tbl_pages_templates SET `sortorder` = (`sortorder` + 1) WHERE `sortorder` < '" . $r['sortorder'] . "'");
                     General::deleteFile(PAGES . "/templates/" . $filename . ".xsl");
                 }
                 redirect($this->_Parent->getCurrentPageURL());
                 break;
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:29,代码来源:content.manage.php

示例5: cbSectionPreDelete

 public function cbSectionPreDelete($context)
 {
     $section_ids = implode(',', $context['section_ids']);
     $sections = Symphony::Database()->fetchCol('handle', "SELECT * FROM `tbl_sections` WHERE id IN ({$section_ids})");
     foreach ($sections as $section) {
         General::deleteFile(WORKSPACE . "/sections/{$section}.xml");
     }
 }
开发者ID:rainerborene,项目名称:schema_migration,代码行数:8,代码来源:extension.driver.php

示例6: entryDataCleanup

 public function entryDataCleanup($entry_id, $data)
 {
     foreach (FLang::instance()->ld()->languageCodes() as $language_code) {
         $file_location = WORKSPACE . '/' . ltrim($data['file-' . $language_code], '/');
         if (is_file($file_location)) {
             General::deleteFile($file_location);
         }
     }
     parent::entryDataCleanup($entry_id);
     return true;
 }
开发者ID:nanymor,项目名称:multilingual_upload_field,代码行数:11,代码来源:field.multilingualupload.php

示例7: uninstall

 public function uninstall()
 {
     $this->_Parent->Database->query('DROP TABLE IF EXISTS tbl_markitup_fields');
     $this->_Parent->Database->query('DROP TABLE IF EXISTS tbl_markitup_cache');
     $files = General::listStructure(CACHE, array('css', 'js'), false, 'asc');
     if (empty($files['filelist'])) {
         return true;
     }
     foreach ($files['filelist'] as $file) {
         if (strpos(CACHE . "/{$file}", 'markitup_') !== false) {
             General::deleteFile(CACHE . "/{$file}");
         }
     }
     $this->_Parent->Configuration->remove('markitup');
     return $this->_Parent->saveConfig();
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:16,代码来源:extension.driver.php

示例8: action

 function action()
 {
     $FileManager =& $this->_Parent->ExtensionManager->create('filemanager');
     $file = new File(DOCROOT . $FileManager->getStartLocation() . $_GET['file']);
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $file->setName($fields['name']);
         if (isset($fields['contents'])) {
             $file->setContents($fields['contents']);
         }
         $file->setPermissions($fields['permissions']);
         $relpath = str_replace(DOCROOT . $FileManager->getStartLocation(), NULL, dirname($_GET['file']));
         if ($file->isWritable()) {
             redirect($FileManager->baseURL() . 'properties/?file=' . rtrim(dirname($_GET['file']), '/') . '/' . $file->name() . '&result=saved');
         } else {
             redirect($FileManager->baseURL() . 'browse/' . $relpath);
         }
     } elseif (isset($_POST['action']['delete'])) {
         General::deleteFile($file->path() . '/' . $file->name());
         $relpath = str_replace(DOCROOT . $FileManager->getStartLocation(), NULL, dirname($_GET['file']));
         redirect($FileManager->baseURL() . 'browse/' . $relpath);
     }
 }
开发者ID:pointybeard,项目名称:filemanager,代码行数:23,代码来源:content.properties.php

示例9: __actionIndex

 public function __actionIndex()
 {
     $sections_post = @$_POST['sections'];
     if (empty($this->_driver)) {
         $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     }
     if (@isset($_POST['action']['save'])) {
         $blueprint = new contentBlueprintsDatasources();
         $sm = new SectionManager($this->_Parent);
         $sections = $sm->fetch();
         foreach ($sections as $section) {
             $file = DATASOURCES . '/data.section_schema_' . str_replace('-', '_', $section->_data['handle']) . '.php';
             General::deleteFile($file);
             if (in_array($section->_data['handle'], $sections_post)) {
                 $dsShell = file_get_contents(TEMPLATE . '/datasource.tpl');
                 $dsShell = str_replace("require_once(TOOLKIT . '/class.datasource.php');", "require_once(TOOLKIT . '/class.datasource.php');\n\trequire_once(TOOLKIT . '/class.sectionmanager.php');\n\trequire_once(TOOLKIT . '/class.fieldmanager.php');\n\trequire_once(TOOLKIT . '/class.entrymanager.php');", $dsShell);
                 $dsShell = str_replace('<!-- CLASS NAME -->', 'section_schema_' . str_replace('-', '_', $section->_data['handle']), $dsShell);
                 $dsShell = str_replace('<!-- FILTERS -->', '', $dsShell);
                 $dsShell = str_replace('<!-- INCLUDED ELEMENTS -->', '', $dsShell);
                 $dsShell = str_replace('<!-- DS DEPENDANCY LIST -->', '""', $dsShell);
                 $params['rootelement'] = 'section-schema';
                 $blueprint->__injectVarList($dsShell, $params);
                 $about = array('name' => 'Section Schema: ' . $section->_data['name'], 'version' => '1.0', 'release date' => DateTimeObj::getGMT('c'), 'author name' => $this->_Parent->Author->getFullName(), 'author website' => URL, 'author email' => $this->_Parent->Author->get('email'));
                 $blueprint->__injectAboutInformation($dsShell, $about);
                 $dsShell = str_replace('<!-- SOURCE -->', $section->_data['id'], $dsShell);
                 $dsShell = str_replace('return true;', 'return false;', $dsShell);
                 $dsShell = str_replace('<!-- GRAB -->', "\$extension = \$this->_Parent->ExtensionManager->create('section_schemas');" . self::CRLF . "\t\t\t\t\$extension->getSectionSchema(\$result, \$this->getSource());", $dsShell);
                 $dsShell = str_replace('<!-- EXTRAS -->', '', $dsShell);
                 if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $dsShell, $this->_Parent->Configuration->get('write_mode', 'file')))) {
                     $this->pageAlert(__('Failed to write data sources to <code>%s</code>. Please check permissions.', array(DATASOURCES)), Alert::ERROR);
                 } else {
                     $this->pageAlert('Section Schema data sources saved.', Alert::SUCCESS);
                 }
             }
         }
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:37,代码来源:content.list.php

示例10: action

 function action()
 {
     $this->_existing_file = isset($this->_context[1]) ? $this->_context[1] . '.xsl' : NULL;
     if (array_key_exists('save', $_POST['action']) || array_key_exists('done', $_POST['action'])) {
         $fields = $_POST['fields'];
         $this->_errors = array();
         if (!isset($fields['name']) || trim($fields['name']) == '') {
             $this->_errors['name'] = __('Name is a required field.');
         }
         if (!isset($fields['body']) || trim($fields['body']) == '') {
             $this->_errors['body'] = __('Body is a required field.');
         } elseif (!General::validateXML($fields['body'], $errors, false, new XSLTProcess())) {
             $this->_errors['body'] = __('This document is not well formed. The following error was returned: <code>%s</code>', array($errors[0]['message']));
         }
         if (empty($this->_errors)) {
             $fields['name'] = Lang::createFilename($fields['name']);
             if (General::right($fields['name'], 4) != '.xsl') {
                 $fields['name'] .= '.xsl';
             }
             $file = UTILITIES . '/' . $fields['name'];
             ##Duplicate
             if ($this->_context[0] == 'edit' && ($this->_existing_file != $fields['name'] && is_file($file))) {
                 $this->_errors['name'] = __('A Utility with that name already exists. Please choose another.');
             } elseif ($this->_context[0] == 'new' && is_file($file)) {
                 $this->_errors['name'] = __('A Utility with that name already exists. Please choose another.');
             } elseif (!($write = General::writeFile($file, $fields['body'], $this->_Parent->Configuration->get('write_mode', 'file')))) {
                 $this->pageAlert(__('Utility could not be written to disk. Please check permissions on <code>/workspace/utilities</code>.'), Alert::ERROR);
             } else {
                 ## Remove any existing file if the filename has changed
                 if ($this->_existing_file && $file != UTILITIES . '/' . $this->_existing_file) {
                     General::deleteFile(UTILITIES . '/' . $this->_existing_file);
                 }
                 ## TODO: Fix me
                 ###
                 # Delegate: Edit
                 # Description: After saving the asset, the file path is provided.
                 //$ExtensionManager->notifyMembers('Edit', getCurrentPage(), array('file' => $file));
                 redirect(URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $fields['name']) . '/' . ($this->_context[0] == 'new' ? 'created' : 'saved') . '/');
             }
         }
     } elseif ($this->_context[0] == 'edit' && @array_key_exists('delete', $_POST['action'])) {
         ## TODO: Fix me
         ###
         # Delegate: Delete
         # Description: Prior to deleting the asset file. Target file path is provided.
         //$ExtensionManager->notifyMembers('Delete', getCurrentPage(), array('file' => WORKSPACE . '/' . $this->_existing_file_rel));
         General::deleteFile(UTILITIES . '/' . $this->_existing_file);
         redirect(URL . '/symphony/blueprints/components/');
     }
 }
开发者ID:bauhouse,项目名称:sym-fluidgrids,代码行数:50,代码来源:content.blueprintsutilities.php

示例11: __formAction


//.........这里部分代码省略.........
            }
            /**
             * Allows adding documentation for new filters. A reference to the $documentation
             * array is provided, along with selected filters
             * @delegate AppendEventFilterDocumentation
             * @param string $context
             * '/blueprints/events/(edit|new|info)/'
             * @param array $selected
             *  An array of all the selected filters for this Event
             * @param array $documentation
             *  An array of all the documentation XMLElements, passed by reference
             */
            Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/' . $this->_context[0] . '/', array('selected' => $filters, 'documentation' => &$documentation_parts));
            $documentation = join(self::CRLF, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $documentation_parts));
            $documentation = str_replace('\'', '\\\'', $documentation);
            $eventShell = str_replace('<!-- CLASS NAME -->', $classname, $eventShell);
            $eventShell = str_replace('<!-- SOURCE -->', $source, $eventShell);
            $eventShell = str_replace('<!-- DOCUMENTATION -->', General::tabsToSpaces($documentation, 2), $eventShell);
            $eventShell = str_replace('<!-- ROOT ELEMENT -->', $rootelement, $eventShell);
            ## Remove left over placeholders
            $eventShell = preg_replace(array('/<!--[\\w ]++-->/'), '', $eventShell);
            if ($this->_context[0] == 'new') {
                /**
                 * Prior to creating an Event, the file path where it will be written to
                 * is provided and well as the contents of that file.
                 *
                 * @delegate EventsPreCreate
                 * @since Symphony 2.2
                 * @param string $context
                 * '/blueprints/events/'
                 * @param string $file
                 *  The path to the Event file
                 * @param string $contents
                 *  The contents for this Event as a string passed by reference
                 * @param array $filters
                 *  An array of the filters attached to this event
                 */
                Symphony::ExtensionManager()->notifyMembers('EventPreCreate', '/blueprints/events/', array('file' => $file, 'contents' => &$eventShell, 'filters' => $filters));
            } else {
                /**
                 * Prior to editing an Event, the file path where it will be written to
                 * is provided and well as the contents of that file.
                 *
                 * @delegate EventPreEdit
                 * @since Symphony 2.2
                 * @param string $context
                 * '/blueprints/events/'
                 * @param string $file
                 *  The path to the Event file
                 * @param string $contents
                 *  The contents for this Event as a string passed by reference
                 * @param array $filters
                 *  An array of the filters attached to this event
                 */
                Symphony::ExtensionManager()->notifyMembers('EventPreEdit', '/blueprints/events/', array('file' => $file, 'contents' => &$eventShell, 'filters' => $filters));
            }
            // Write the file
            if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $eventShell, Symphony::Configuration()->get('write_mode', 'file')))) {
                $this->pageAlert(__('Failed to write Event to <code>%s</code>. Please check permissions.', array(EVENTS)), Alert::ERROR);
            } else {
                if ($queueForDeletion) {
                    General::deleteFile($queueForDeletion);
                    $sql = "SELECT * FROM `tbl_pages` WHERE `events` REGEXP '[[:<:]]" . $existing_handle . "[[:>:]]' ";
                    $pages = Symphony::Database()->fetch($sql);
                    if (is_array($pages) && !empty($pages)) {
                        foreach ($pages as $page) {
                            $page['events'] = preg_replace('/\\b' . $existing_handle . '\\b/i', $classname, $page['events']);
                            Symphony::Database()->update($page, 'tbl_pages', "`id` = '" . $page['id'] . "'");
                        }
                    }
                }
                if ($this->_context[0] == 'new') {
                    /**
                     * After creating the Event, the path to the Event file is provided
                     *
                     * @delegate EventPostCreate
                     * @since Symphony 2.2
                     * @param string $context
                     * '/blueprints/events/'
                     * @param string $file
                     *  The path to the Event file
                     */
                    Symphony::ExtensionManager()->notifyMembers('EventPostCreate', '/blueprints/events/', array('file' => $file));
                } else {
                    /**
                     * After editing the Event, the path to the Event file is provided
                     *
                     * @delegate EventPostEdit
                     * @since Symphony 2.2
                     * @param string $context
                     * '/blueprints/events/'
                     * @param string $file
                     *  The path to the Event file
                     */
                    Symphony::ExtensionManager()->notifyMembers('EventPostEdit', '/blueprints/events/', array('file' => $file));
                }
                redirect(SYMPHONY_URL . '/blueprints/events/edit/' . $classname . '/' . ($this->_context[0] == 'new' ? 'created' : 'saved') . '/');
            }
        }
    }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:101,代码来源:content.blueprintsevents.php

示例12: action

 public function action()
 {
     $this->_existing_file = isset($this->_context[1]) ? $this->_context[1] . '.xsl' : NULL;
     if (array_key_exists('save', $_POST['action']) || array_key_exists('done', $_POST['action'])) {
         $fields = $_POST['fields'];
         $this->_errors = array();
         if (!isset($fields['name']) || trim($fields['name']) == '') {
             $this->_errors['name'] = __('Name is a required field.');
         }
         if (!isset($fields['body']) || trim($fields['body']) == '') {
             $this->_errors['body'] = __('Body is a required field.');
         } elseif (!General::validateXML($fields['body'], $errors, false, new XSLTProcess())) {
             $this->_errors['body'] = __('This document is not well formed. The following error was returned: <code>%s</code>', array($errors[0]['message']));
         }
         $fields['name'] = Lang::createFilename($fields['name']);
         if (General::right($fields['name'], 4) != '.xsl') {
             $fields['name'] .= '.xsl';
         }
         $file = UTILITIES . '/' . $fields['name'];
         ##Duplicate
         if ($this->_context[0] == 'edit' && ($this->_existing_file != $fields['name'] && is_file($file))) {
             $this->_errors['name'] = __('A Utility with that name already exists. Please choose another.');
         } elseif ($this->_context[0] == 'new' && is_file($file)) {
             $this->_errors['name'] = __('A Utility with that name already exists. Please choose another.');
         }
         if (empty($this->_errors)) {
             if ($this->_context[0] == 'new') {
                 /**
                  * Just before the Utility has been created
                  *
                  * @delegate UtilityPreCreate
                  * @since Symphony 2.2
                  * @param string $context
                  * '/blueprints/utilities/'
                  * @param string $file
                  *  The path to the Utility file
                  * @param string $contents
                  *  The contents of the `$fields['body']`, passed by reference
                  */
                 Symphony::ExtensionManager()->notifyMembers('UtilityPreCreate', '/blueprints/utilities/', array('file' => $file, 'contents' => &$fields['body']));
             } else {
                 /**
                  * Just before the Utility has been updated
                  *
                  * @delegate UtilityPreEdit
                  * @since Symphony 2.2
                  * @param string $context
                  * '/blueprints/utilities/'
                  * @param string $file
                  *  The path to the Utility file
                  * @param string $contents
                  *  The contents of the `$fields['body']`, passed by reference
                  */
                 Symphony::ExtensionManager()->notifyMembers('UtilityPreEdit', '/blueprints/utilities/', array('file' => $file, 'contents' => &$fields['body']));
             }
             ##Write the file
             if (!($write = General::writeFile($file, $fields['body'], Symphony::Configuration()->get('write_mode', 'file')))) {
                 $this->pageAlert(__('Utility could not be written to disk. Please check permissions on <code>/workspace/utilities</code>.'), Alert::ERROR);
             } else {
                 ## Remove any existing file if the filename has changed
                 if ($this->_existing_file && $file != UTILITIES . '/' . $this->_existing_file) {
                     General::deleteFile(UTILITIES . '/' . $this->_existing_file);
                 }
                 if ($this->_context[0] == 'new') {
                     /**
                      * Just after the Utility has been written to disk
                      *
                      * @delegate UtilityPostCreate
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/utilities/'
                      * @param string $file
                      *  The path to the Utility file
                      */
                     Symphony::ExtensionManager()->notifyMembers('UtilityPostCreate', '/blueprints/utilities/', array('file' => $file));
                 } else {
                     /**
                      * Just after a Utility has been edited and written to disk
                      *
                      * @delegate UtilityPostEdit
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/utilities/'
                      * @param string $file
                      *  The path to the Utility file
                      */
                     Symphony::ExtensionManager()->notifyMembers('UtilityPostEdit', '/blueprints/utilities/', array('file' => $file));
                 }
                 redirect(SYMPHONY_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $fields['name']) . '/' . ($this->_context[0] == 'new' ? 'created' : 'saved') . '/');
             }
         }
     } elseif ($this->_context[0] == 'edit' && @array_key_exists('delete', $_POST['action'])) {
         /**
          * Prior to deleting the Utility
          *
          * @delegate UtilityPreDelete
          * @since Symphony 2.2
          * @param string $context
          * '/blueprints/utilities/'
          * @param string $file
//.........这里部分代码省略.........
开发者ID:benesch,项目名称:hilton-unar,代码行数:101,代码来源:content.blueprintsutilities.php

示例13: delete

 public function delete($datasource)
 {
     /*
     	TODO:
     	Upon deletion of the event, views need to be updated to remove
     	it's associated with the event
     */
     if (!$datasource instanceof DataSource) {
         $datasource = Datasource::loadFromHandle($datasource);
     }
     $handle = $datasource->handle;
     if (!$datasource->allowEditorToParse()) {
         throw new DataSourceException(__('Datasource cannot be deleted, the Editor does not have permission.'));
     }
     return General::deleteFile(DATASOURCES . "/{$handle}.php");
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:16,代码来源:class.datasource.php

示例14: deletePageFiles

 /**
  * Given a Page's `$path` and `$handle`, this function will remove
  * it's templates from the `PAGES` directory returning boolean on
  * completion
  *
  * @param string $page_path
  *  The path of the Page, which is the handles of the Page parents. If the
  *  page has multiple parents, they will be separated by a forward slash.
  *  eg. article/read. If a page has no parents, this parameter should be null.
  * @param string $handle
  *  A Page handle, generated using `PageManager::createHandle`.
  * @return boolean
  */
 public static function deletePageFiles($page_path, $handle)
 {
     $file = PageManager::resolvePageFileLocation($page_path, $handle);
     // Nothing to do:
     if (!file_exists($file)) {
         return true;
     }
     // Delete it:
     if (General::deleteFile($file)) {
         return true;
     }
     return false;
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:26,代码来源:class.pagemanager.php

示例15: beginProcess

 /**
  * Uploads the zip file to a target directory using the current date. The function
  * then extracts the content of the zip to the same folder, removes the zip file
  * after extraction and calls the openExtracted function to append the files to the
  * $files array.
  *
  * @return boolean
  *	True if the $files array is not empty, false otherwise
  */
 public function beginProcess()
 {
     if (empty($_FILES['fields']['name']['file'])) {
         return false;
     }
     $target = $this->getTarget() . DateTimeObj::get('d-m-Y');
     foreach ($_FILES['fields']['error'] as $key => $error) {
         if ($error == UPLOAD_ERR_OK) {
             $tmp = $_FILES['fields']['tmp_name'][$key];
             // Upload files to /workspace/uploads/bulkimporter/11-11-2010
             $file = $_FILES['fields']['name'][$key];
             if (!file_exists($target)) {
                 General::realiseDirectory($target);
             }
             if (!General::uploadFile($target, $file, $tmp)) {
                 return false;
             }
             $uploadedZipPath = $target . "/" . $file;
         }
     }
     $zipManager = new ZipArchive();
     $zip = $zipManager->open($uploadedZipPath);
     // The directory where the extracted zip contents should go to.
     $this->extracted_directory = $target;
     $path = '';
     if ($this->archive_is_parent) {
         $path = '/' . preg_replace('/\\.[^\\.]+$/', '', basename($uploadedZipPath));
         $this->extracted_archive = basename($path);
         if (!file_exists($this->extracted_directory . $path)) {
             General::realiseDirectory($this->extracted_directory . $path);
         }
     }
     $zipManager->extractTo($this->extracted_directory . $path);
     $zipManager->close();
     // Delete the zip file
     General::deleteFile($uploadedZipPath);
     // Add the extracted files to the $files array
     $this->openExtracted($this->extracted_directory);
     return count($this->files) != 0;
 }
开发者ID:brendo,项目名称:bulkimporter,代码行数:49,代码来源:extension.driver.php


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