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


PHP Archive::result_count方法代码示例

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


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

示例1: on_change

 /**
  * Triggers the necessary calculations when a page is added, edited or removed
  *
  * @author Woxxy
  */
 public function on_change($chapter)
 {
     // cleanup the archive if there is one for this chapter
     $archives = new Archive();
     $archives->where('comic_id', $chapter->comic_id)->group_start()->where('chapter_id', $chapter->id)->or_where('volume_id', $chapter->volume)->group_end()->get();
     if ($archives->result_count()) {
         foreach ($archives as $archive) {
             $archive->remove();
         }
     }
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:16,代码来源:page.php

示例2: while

 /**
  * Removes ZIPs that are over the specified size
  * 
  * @author Woxxy
  * @returns bool 
  */
 function remove_old()
 {
     $unlink_errors = 0;
     while ($this->calculate_size() > get_setting('fs_dl_archive_max') * 1024 * 1024) {
         $archive = new Archive();
         $archive->order_by('lastdownload', 'ASC')->limit(1, $unlink_errors)->get();
         if ($archive->result_count() == 1) {
             if (!$archive->remove()) {
                 $unlink_errors++;
             }
         } else {
             break;
         }
     }
 }
开发者ID:bonsoirval,项目名称:FoOlSlide,代码行数:21,代码来源:archive.php

示例3: check

 public function check($repair = FALSE, $recursive = FALSE)
 {
     $dir = "content/comics/" . $this->directory() . "/";
     $errors = array();
     if (!is_dir($dir)) {
         $errors[] = 'comic_directory_not_found';
         set_notice('warning', _('No directory found for:') . ' ' . $this->name . ' (' . $this->directory() . ')');
         log_message('debug', 'check: comic directory missing at ' . $dir);
         if ($repair) {
             // the best we can do is removing the database entry
             $this->remove_comic_db();
         }
     } else {
         // check that there are no unidentified files in the comic folder
         $map = directory_map($dir, 1);
         foreach ($map as $key => $item) {
             $item_path = $dir . $item;
             if (is_dir($item_path)) {
                 // gotta split the directory to get stub and uniqid
                 $item_arr = explode('_', $item);
                 $uniqid = end($item_arr);
                 $stub = str_replace('_' . $uniqid, '', $item);
                 $chapter = new Chapter();
                 $chapter->where('stub', $stub)->where('uniqid', $uniqid)->get();
                 if ($chapter->result_count() == 0) {
                     $errors[] = 'comic_unidentified_directory_found';
                     set_notice('warning', _('Unidentified directory found at:') . ' ' . $item_path);
                     log_message('debug', 'check: unidentified directory found at ' . $item_path);
                     if ($repair) {
                         // you have to remove all the files in the folder first
                         delete_files($item_path, TRUE);
                         rmdir($item_path);
                     }
                 }
             } else {
                 if ($item != $this->thumbnail && $item != 'thumb_' . $this->thumbnail) {
                     $ext = strtolower(substr($item, -4));
                     if (in_array($ext, array('.zip'))) {
                         $archive = new Archive();
                         $archive->where('comic_id', $this->id)->where('filename', $item)->get();
                         if ($archive->result_count()) {
                             continue;
                         }
                     }
                     // if it's not the thumbnail image, it's an unidentified file
                     $errors[] = 'comic_unidentified_file_found';
                     set_notice('warning', _('Unidentified file found at:') . ' ' . $item_path);
                     log_message('debug', 'check: unidentified file found at ' . $item_path);
                     if ($repair) {
                         unlink($item_path);
                     }
                 }
             }
         }
     }
     return $errors;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:57,代码来源:comic.php

示例4: on_change

 /**
  * Triggers the necessary calculations when a page is added, edited or removed
  * 
  * @author Woxxy
  */
 public function on_change($chapter_id)
 {
     // cleanup the archive if there is one for this chapter
     $archive = new Archive();
     $archive->where('chapter_id', $chapter_id)->get();
     if ($archive->result_count() == 1) {
         $archive->remove();
     }
 }
开发者ID:bonsoirval,项目名称:FoOlSlide,代码行数:14,代码来源:page.php

示例5: check

 function check($repair = FALSE)
 {
     // make sure we got the comic
     if ($this->get_comic() === FALSE) {
         $errors[] = 'chapter_comic_entry_not_found';
         set_notice('warning', _('Found a chapter entry without a comic entry, Chapter ID: ' . $this->id));
         log_message('debug', 'check: chapter entry without comic entry');
         if ($repair) {
             $this->remove_chapter_db();
         }
         return FALSE;
     }
     $errors = array();
     // check if the directory exists at all
     $path = 'content/comics/' . $this->comic->directory() . '/' . $this->directory() . '/';
     if (!is_dir($path)) {
         $errors[] = 'chapter_directory_not_found';
         set_notice('warning', _('No directory found for:') . ' ' . $this->comic->name . ' > ' . $this->title());
         log_message('debug', 'check: chapter directory missing at ' . $path);
         // the folder doesn't exist, so get rid of the entry from database
         if ($repair) {
             $this->remove_chapter_db();
         }
         // there's no recovery from this, return the error codes
         return $errors;
     }
     // check if there are extraneous files in the folder
     $files = get_dir_file_info($path);
     foreach ($files as $key => $file) {
         // check that the file is writable
         if (!is_writable($file['relative_path'])) {
             // non writable files are horrendous, send a notice and stop the machines
             $errors[] = 'chapter_non_writable_file';
             set_notice('warning', _('Found non writable files in the comics folder. Check your files permissions.'));
             log_message('debug', 'check: non writable file: ' . $file['relative_path']);
             return $errors;
         }
         // get the extension
         $ext = strtolower(substr($file['name'], -4));
         if (in_array($ext, array('.zip'))) {
             // maybe it's just the zip created by the archive system
             $archives = new Archive();
             $archives->where('comic_id', $this->comic_id)->where('chapter_id', $this->id)->where('volume_id', 0)->get();
             if ($archives->result_count()) {
                 foreach ($archives as $archive) {
                     // we actually have an archive, but is it the same file?
                     if ($file['name'] == $archive->filename) {
                         // same file, unset to confirm
                         unset($files[$key]);
                         continue;
                     }
                 }
             }
         }
         if (in_array($ext, array('.png', '.jpg', 'jpeg', '.gif'))) {
             $page = new Page();
             $page->where('chapter_id', $this->id)->where('filename', $file['name'])->get();
             if ($page->result_count() == 1) {
                 // it's a simple page, unset to confirm
                 unset($files[$key]);
                 continue;
             }
         }
     }
     // now we have an array with files that don't belong here
     foreach ($files as $file) {
         $errors[] = 'chapter_unidentified_file';
         set_notice('warning', _('Unidentified file found in:') . ' ' . $this->comic->name . ' > ' . $this->title() . ': ' . $file['name']);
         log_message('debug', 'check: unidentified file ' . $file['relative_path'] . $file['name']);
         // repairing this means getting rid of extraneous files
         if ($repair) {
             // it's possible the file is not removeable
             if (is_writable($file['relative_path'] . $file['name'])) {
                 // the files SHOULD be writable, we checked it earlier
                 if (is_dir($file['relative_path'] . $file['name'])) {
                     delete_files($file['relative_path'] . $file['name']);
                     rmdir($file['relative_path'] . $file['name']);
                 } else {
                     unlink($file['relative_path'] . $file['name']);
                 }
             }
         }
     }
     // everything's been checked. The errors are in the set_notice system
     return $errors;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:86,代码来源:chapter.php


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