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


PHP Ak::file_delete方法代码示例

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


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

示例1: setup

 public function setup()
 {
     $this->installAndIncludeModels(array('Post', 'Tag', 'Comment'));
     $Installer = new AkInstaller();
     @$Installer->dropTable('posts_tags');
     @Ak::file_delete(AK_MODELS_DIR . DS . 'post_tag.php');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:_AkActiveRecord_finders.php

示例2: Test_file_delete

 function Test_file_delete()
 {
     $this->assertFalse(!Ak::file_delete(AK_CACHE_DIR . DS . 'test_file_1.txt'));
     $this->assertFalse(!Ak::file_delete(AK_CACHE_DIR . DS . 'test_file_2.txt'));
     $this->assertFalse(!Ak::file_delete(AK_CACHE_DIR . DS . 'test_file_3.txt'));
     $this->assertFalse(!Ak::file_delete(AK_CACHE_DIR . '/test_file_4.txt'));
     $this->assertFalse(!Ak::file_delete('ak_test_folder/new_folder/test_file.txt'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:_Ak_file_functions.php

示例3: Test_file_delete

 public function Test_file_delete()
 {
     $this->assertFalse(!Ak::file_delete(AK_TMP_DIR . DS . 'test_file_1.txt'));
     $this->assertFalse(!Ak::file_delete(AK_TMP_DIR . DS . 'test_file_2.txt'));
     $this->assertFalse(!Ak::file_delete('cache/test_file_3.txt'));
     $this->assertFalse(!Ak::file_delete('cache/test_file_4.txt'));
     $this->assertFalse(!Ak::file_delete('ak_test_folder/new_folder/test_file.txt'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:_Ak_file_functions.php

示例4: convert

 public function convert()
 {
     $excel = new COM('excel.application') or die('Unable to instantiate Excel');
     $excel->Visible = false;
     $excel->WorkBooks->Open($this->source_file);
     $excel->WorkBooks[1]->SaveAs($this->destination_file, $this->_file_type_codes[$this->convert_to]);
     $excel->Quit();
     unset($excel);
     $result = Ak::file_get_contents($this->destination_file);
     $this->delete_source_file ? @Ak::file_delete($this->source_file) : null;
     $this->keep_destination_file ? null : Ak::file_delete($this->destination_file);
     return $result;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:13,代码来源:AkMsExcelToMany.php

示例5: convert

 public function convert()
 {
     $word = new COM('word.application') or die('Unable to instantiate Word');
     $word->Visible = false;
     $word->Documents->Open($this->source_file);
     $word->Documents[1]->SaveAs($this->destination_file, $this->_file_type_codes[$this->convert_to]);
     $word->Quit();
     $word = null;
     $result = Ak::file_get_contents($this->destination_file);
     $this->delete_source_file ? Ak::file_delete($this->source_file) : null;
     $this->keep_destination_file ? null : Ak::file_delete($this->destination_file);
     return $result;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:13,代码来源:AkMsWordToMany.php

示例6: convert

 function convert()
 {
     $xdoc2txt_bin = AK_VENDOR_DIR . DS . 'hyperestraier' . DS . 'xdoc2txt.exe';
     if (AK_OS != 'WINDOWS') {
         trigger_error(Ak::t('Xdoc2Text is a windows only application. Please use wvWare instead'), E_USER_WARNING);
         return false;
     }
     if (!file_exists($xdoc2txt_bin)) {
         trigger_error(Ak::t('Could not find xdoc2txt.exe on %path. Please download it from http://www31.ocn.ne.jp/~h_ishida/xdoc2txt.html', array('%path' => $xdoc2txt_bin)), E_USER_WARNING);
         return false;
     }
     exec('@"' . $xdoc2txt_bin . '" -f "' . $this->source_file . '" "' . $this->destination_file . '"');
     $result = Ak::file_get_contents($this->destination_file);
     $this->delete_source_file ? @Ak::file_delete($this->source_file) : null;
     $this->keep_destination_file ? null : Ak::file_delete($this->destination_file);
     return $result;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:AkXdocToText.php

示例7: convert

 function convert()
 {
     $this->handler->read($this->source_file);
     $result = array();
     for ($i = 1; $i <= $this->handler->sheets[0]['numRows']; $i++) {
         if ($i === 1) {
             @($col_names = $this->handler->sheets[0]['cells'][$i - 1]);
             foreach (range(1, $this->handler->sheets[0]['numCols']) as $column_number) {
                 $col_names[$column_number - 1] = empty($col_names[$column_number - 1]) ? $column_number : trim($col_names[$column_number - 1], "\t\n\r ");
             }
             continue;
         }
         for ($j = 0; $j < $this->handler->sheets[0]['numCols']; $j++) {
             $result[$i - 2][$col_names[$j]] = isset($this->handler->sheets[0]['cells'][$i - 1][$j]) ? $this->handler->sheets[0]['cells'][$i - 1][$j] : null;
         }
     }
     $this->delete_source_file ? @Ak::file_delete($this->source_file) : null;
     return $result;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:19,代码来源:AkExcelToArray.php

示例8: directory_delete

 function directory_delete($dir_name, $options = array())
 {
     $default_options = array('ftp' => defined('AK_DELETE_FILES_USING_FTP') && AK_DELETE_FILES_USING_FTP, 'base_path' => AK_BASE_DIR);
     $options = array_merge($default_options, $options);
     $sucess = true;
     $dir_name = Ak::_getRestrictedPath($dir_name, $options);
     if (empty($dir_name)) {
         return false;
     }
     if ($options['ftp']) {
         require_once AK_LIB_DIR . DS . 'AkFtp.php';
         return AkFtp::delete($dir_name);
     } else {
         $items = glob($options['base_path'] . DS . $dir_name . "/*");
         $hidden_items = glob($options['base_path'] . DS . $dir_name . "/.*");
         $fs_items = $items || $hidden_items ? array_merge((array) $items, (array) $hidden_items) : false;
         if ($fs_items) {
             $items_to_delete = array('directories' => array(), 'files' => array());
             foreach ($fs_items as $fs_item) {
                 if ($fs_item[strlen($fs_item) - 1] != '.') {
                     $items_to_delete[is_dir($fs_item) ? 'directories' : 'files'][] = $fs_item;
                 }
             }
             foreach ($items_to_delete['files'] as $file) {
                 Ak::file_delete($file, $options);
             }
             foreach ($items_to_delete['directories'] as $directory) {
                 $sucess = $sucess ? Ak::directory_delete($directory, $options) : $sucess;
             }
         }
         return $sucess ? @rmdir($options['base_path'] . DS . $dir_name) : $sucess;
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:33,代码来源:Ak.php

示例9: _embedReferencedImages

 function _embedReferencedImages($html)
 {
     $images = TextHelper::get_image_urls_from_html($html);
     $html_images = array();
     if (!empty($images)) {
         require_once AK_LIB_DIR . DS . 'AkImage.php';
         require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'asset_tag_helper.php';
         foreach ($images as $image) {
             $image = AssetTagHelper::_compute_public_path($image);
             $extenssion = substr($image, strrpos('.' . $image, '.'));
             $image_name = Ak::uuid();
             Ak::file_put_contents(AK_CACHE_DIR . DS . 'tmp' . DS . $image_name . $extenssion, file_get_contents($image));
             $NewImage =& new AkImage(AK_CACHE_DIR . DS . 'tmp' . DS . $image_name . $extenssion);
             $NewImage->save(AK_CACHE_DIR . DS . 'tmp' . DS . $image_name . '.png');
             $html_images[$image] = $image_name . '.png';
             Ak::file_delete(AK_CACHE_DIR . DS . 'tmp' . DS . $image_name);
         }
         $html = str_replace(array_keys($html_images), array_values($html_images), $html);
     }
     return array($html_images, $html);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:21,代码来源:AkMailEncoding.php

示例10: test_should_remove_associated_using_the_right_key

 public function test_should_remove_associated_using_the_right_key()
 {
     $Installer = new AkInstaller();
     @$Installer->dropTable('groups_users');
     @Ak::file_delete(AK_MODELS_DIR . DS . 'group_user.php');
     $this->installAndIncludeModels('User', 'Group', array('instantiate' => true));
     $Admin =& $this->Group->create(array('name' => 'Admin'));
     $Moderator =& $this->Group->create(array('name' => 'Moderator'));
     $this->assertFalse($Admin->hasErrors());
     $this->assertFalse($Moderator->hasErrors());
     $Salavert =& $this->User->create(array('name' => 'Jose'));
     $this->assertFalse($Salavert->hasErrors());
     $Salavert->group->setByIds($Admin->getId(), $Moderator->getId());
     $Salavert =& $this->User->find($Salavert->getId());
     $this->assertEqual(2, $Salavert->group->count());
     $Jyrki =& $this->User->create(array('name' => 'Jyrki'));
     $this->assertFalse($Jyrki->hasErrors());
     $Jyrki->group->setByIds($Admin->getId(), $Moderator->getId());
     $Jyrki =& $this->User->find($Jyrki->getId());
     $this->assertEqual(2, $Jyrki->group->count());
     $Jyrki->destroy();
     $Salavert =& $this->User->find($Salavert->getId());
     $this->assertEqual(2, $Salavert->group->count());
 }
开发者ID:joeymetal,项目名称:v1,代码行数:24,代码来源:AkHasAndBelongsToMany.php

示例11: __destruct

 function __destruct()
 {
     if (file_exists($this->_tmp_file)) {
         @Ak::file_delete($this->_tmp_file);
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:6,代码来源:AkImageColorScheme.php

示例12: directory_delete

 function directory_delete($dir_name, $options = array())
 {
     $default_options = array('ftp' => defined('AK_DELETE_FILES_USING_FTP') && AK_DELETE_FILES_USING_FTP, 'base_path' => AK_BASE_DIR);
     $options = array_merge($default_options, $options);
     $sucess = true;
     $dir_name = str_replace('..', '', rtrim($dir_name, '\\/. '));
     if ($dir_name == '') {
         return false;
     }
     $dir_name = trim(str_replace($options['base_path'], '', $dir_name), DS);
     if ($options['ftp']) {
         require_once AK_LIB_DIR . DS . 'AkFtp.php';
         $dir_name = trim(str_replace(array(DS, '//'), array('/', '/'), $dir_name), '/');
         return AkFtp::delete($dir_name);
     } else {
         if ($fs_items = glob($options['base_path'] . DS . $dir_name . "/*")) {
             $items_to_delete = array('directories' => array(), 'files' => array());
             foreach ($fs_items as $fs_item) {
                 $items_to_delete[is_dir($fs_item) ? 'directories' : 'files'][] = $fs_item;
             }
             foreach ($items_to_delete['files'] as $file) {
                 Ak::file_delete($file, $options);
             }
             foreach ($items_to_delete['directories'] as $directory) {
                 $sucess = $sucess ? Ak::directory_delete($directory, $options) : $sucess;
             }
             return $sucess;
         }
         return rmdir($options['base_path'] . DS . $dir_name);
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:31,代码来源:Ak.php

示例13: test_clear

 function test_clear()
 {
     Ak::file_delete(AK_MODELS_DIR.DS.'todo_service.php');
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:AkActionWebServiceApi.php

示例14: runTaskAsDaemon

    public function runTaskAsDaemon($task_name, $options = array())
    {
        $this->_ensurePosixAndPcntlAreAvailable();

        require_once 'System/Daemon.php';

        $app_name = AkInflector::underscore($task_name);
        $pid_file = AK_BASE_DIR.DS.'run'.DS.$app_name.DS.$app_name.'.pid';
        $log_file = AK_LOG_DIR.DS.'daemons'.DS.$app_name.'.log';

        if(!file_exists($pid_file)){
            if(empty($options['attributes']['kill'])){
                Ak::file_put_contents($pid_file, '');
                Ak::file_delete($pid_file);
            }else{
                $this->error("Could not kill process for $task_name", true);
            }
        }else{
            $pid = (int)file_get_contents($pid_file);
            if($pid > 0){
                if(!empty($options['attributes']['kill'])){
                    $this->message("Killing process $pid");
                    `kill $pid`;
                    Ak::file_delete($pid_file);
                    die();
                }elseif(!empty($options['attributes']['restart'])){
                    $this->message("Restarting $task_name.");
                    $this->message(`kill $pid`);
                }else{
                    $this->error("Daemon for $task_name still running ($pid_file).\nTask aborted.", true);
                }
            }
        }

        if(!empty($options['attributes']['kill']) && empty($pid)){
            $this->error("No daemon running for task $task_name", true);
        }
        unset($options['attributes']['restart']);

        if(!file_exists($log_file)){
            Ak::file_put_contents($log_file, '');
        }

        System_Daemon::setOption('appName', $app_name);
        System_Daemon::setOption('appDir', AK_BASE_DIR);
        System_Daemon::setOption('logLocation', $log_file);
        System_Daemon::setOption('appRunAsUID', posix_geteuid());
        System_Daemon::setOption('appRunAsGID', posix_getgid());
        System_Daemon::setOption('appPidLocation', $pid_file);
        $this->message("Staring daemon. ($log_file)");
        System_Daemon::start();
        $dsn = Ak::getStaticVar('dsn');
        defined('AK_SKIP_DB_CONNECTION') && AK_SKIP_DB_CONNECTION ? null : Ak::db($dsn);
        $this->runTask($task_name, $options);
        System_Daemon::stop();
        Ak::file_delete($pid_file);
        die();
    }
开发者ID:joeymetal,项目名称:v1,代码行数:58,代码来源:makelos.php

示例15: _moveOldVersionsFileToNewLocation

 function _moveOldVersionsFileToNewLocation($options)
 {
     $old_filename = $this->_versionPath_Deprecated($options); 
     if (is_file($old_filename)){
         $this->setInstalledVersion(Ak::file_get_contents($old_filename),$options);  
         Ak::file_delete($old_filename); 
         Ak::file_put_contents(AK_APP_INSTALLERS_DIR.DS.'versions'.DS.'NOTE',"Version information is now stored in the temp folder. \n\rYou can safely move this files here over there to tmp/installer_versions/* or delete this directory if empty.");     
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:AkInstaller.php


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