Example #1
0
	/**
	 * 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();
		}
	}
Example #2
0
 /**
  * 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;
         }
     }
 }
Example #3
0
 /**
  * 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();
     }
 }