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


PHP Filesystem::Close方法代码示例

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


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

示例1: Delete

 /**
  * Delete an avatar
  * @param integer $filename Name of file to be deleted
  * @return void Avatar is deleted from filesystem
  */
 static function Delete($filename)
 {
     try {
         Filesystem::Open();
         Filesystem::Delete(UPLOAD_PATH . '/avatars/' . $filename);
         Filesystem::Close();
     } catch (Exception $e) {
         App::Alert('Error During Avatar Removal', "Unable to delete avatar: {$filename}. Error: " . $e->getMessage());
     }
 }
开发者ID:KmServer,项目名称:CumulusClips,代码行数:15,代码来源:Avatar.php

示例2: array_search

        $key = array_search($_GET['delete'], $installed_plugins);
        if ($key !== false) {
            if (method_exists($_GET['delete'], 'Uninstall')) {
                call_user_func(array($_GET['delete'], 'Uninstall'));
            }
            unset($installed_plugins[$key]);
            Settings::Set('installed_plugins', serialize($installed_plugins));
        }
        // Delete plugin files
        $plugin_info = Plugin::GetPluginInfo($_GET['delete']);
        $message = $plugin_info->name . ' plugin has been deleted';
        $message_type = 'success';
        try {
            Filesystem::Open();
            Filesystem::Delete(DOC_ROOT . '/cc-content/plugins/' . $_GET['delete']);
            Filesystem::Close();
        } catch (Exception $e) {
            $message = $e->getMessage();
            $message_type = 'error';
        }
    }
} else {
    if (!empty($_GET['enable']) && !ctype_space($_GET['enable'])) {
        // Validate plugin
        if (Plugin::ValidPlugin($_GET['enable']) && !in_array($_GET['enable'], $enabled_plugins)) {
            // Install plugin if applicable
            if (!in_array($_GET['enable'], $installed_plugins)) {
                if (method_exists($_GET['enable'], 'Install')) {
                    call_user_func(array($_GET['enable'], 'Install'));
                }
                $installed_plugins[] = $_GET['enable'];
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:plugins.php

示例3: Delete

 /**
  * Delete a video
  * @param integer $video_id ID of video to be deleted
  * @return void Video is deleted from database and all related files and records are also deleted
  */
 static function Delete($video_id)
 {
     App::LoadClass('Rating');
     App::LoadClass('Flag');
     App::LoadClass('Favorite');
     App::LoadClass('Comment');
     $db = Database::GetInstance();
     $video = new self($video_id);
     Plugin::Trigger('video.delete');
     // Delete files
     try {
         Filesystem::Open();
         Filesystem::Delete(UPLOAD_PATH . '/flv/' . $video->filename . '.flv');
         Filesystem::Delete(UPLOAD_PATH . '/thumbs/' . $video->filename . '.jpg');
         Filesystem::Delete(UPLOAD_PATH . '/mobile/' . $video->filename . '.mp4');
         Filesystem::Close();
     } catch (Exception $e) {
         App::Alert('Error During Video Removal', "Unable to delete video files for: {$video->filename}. The video has been removed from the system, but the files still remain. Error: " . $e->getMessage());
     }
     // Delete Comments
     $query = "SELECT comment_id FROM " . DB_PREFIX . "comments WHERE video_id = {$video_id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Comment::Delete($row->comment_id);
     }
     // Delete Ratings
     $query = "SELECT rating_id FROM " . DB_PREFIX . "ratings WHERE video_id = {$video_id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Rating::Delete($row->rating_id);
     }
     // Delete Favorites
     $query = "SELECT fav_id FROM " . DB_PREFIX . "favorites WHERE video_id = {$video_id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Favorite::Delete($row->fav_id);
     }
     // Delete Flags
     $query = "SELECT flag_id FROM " . DB_PREFIX . "flags WHERE id = {$video_id} AND type = 'video'";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Flag::Delete($row->flag_id);
     }
     // Delete Video
     $query = "DELETE FROM " . DB_PREFIX . "videos WHERE video_id = {$video_id}";
     $db->Query($query);
 }
开发者ID:KmServer,项目名称:CumulusClips,代码行数:52,代码来源:Video.php


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