コード例 #1
0
ファイル: archive.php プロジェクト: Nakei/FoOlSlide
	/**
	 * Removes ZIPs that are over the specified size
	 * 
	 * @author Woxxy
	 * @returns bool 
	 */
	function remove_old() {
		while ($this->calculate_size() > (get_setting('fs_dl_archive_max') * 1024 * 1024)) {
			$archive = new Archive();
			$archive->order_by('lastdownload', 'ASC')->limit(1)->get();
			$archive->remove();
		}
	}
コード例 #2
0
ファイル: archive.php プロジェクト: bonsoirval/FoOlSlide
 /**
  * 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;
         }
     }
 }
コード例 #3
0
ファイル: page.php プロジェクト: bonsoirval/FoOlSlide
 /**
  * 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();
     }
 }