Compare commits
5 Commits
078ea8d4fa
...
6460cfca37
| Author | SHA1 | Date | |
|---|---|---|---|
| 6460cfca37 | |||
| ee02a15182 | |||
| dca541c6b8 | |||
| b55e3c1d92 | |||
| 7aecf00971 |
|
|
@ -47,12 +47,22 @@ if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
|||
}
|
||||
$data["startindex"] = $currentpage;
|
||||
|
||||
$extracted = false;
|
||||
if ( !is_dir($comicoutputfull) ) {
|
||||
mkdir($comicoutputfull, 0755, true);
|
||||
} else {
|
||||
touch($comicoutputfull);
|
||||
$extracted = true;
|
||||
}
|
||||
|
||||
$files = array();
|
||||
if ( $ext == "cbz" ) {
|
||||
if ( $extracted ) {
|
||||
$contents = glob($comicoutputfull . "*");
|
||||
foreach ( $contents as $i ) {
|
||||
$files[] = basename($i);
|
||||
}
|
||||
} else {
|
||||
if ( $ext == "cbz" ) {
|
||||
$zip = new ZipArchive();
|
||||
$opened = $zip->open($comicfull);
|
||||
for ( $i=0; $i<$zip->numFiles; $i++ ) {
|
||||
|
|
@ -67,7 +77,7 @@ if ( $ext == "cbz" ) {
|
|||
if ( $written ) $files[] = $imgname;
|
||||
}
|
||||
}
|
||||
} elseif ( $ext == "cbr" ) {
|
||||
} elseif ( $ext == "cbr" ) {
|
||||
$rar = RarArchive::open($comicfull);
|
||||
$entries = $rar->getEntries();
|
||||
foreach ( $entries as $entry ) {
|
||||
|
|
@ -80,8 +90,9 @@ if ( $ext == "cbz" ) {
|
|||
}
|
||||
}
|
||||
unset($entry);
|
||||
} else {
|
||||
} else {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
natsort($files);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@ $projectRoot = dirname(dirname(__FILE__));
|
|||
|
||||
require "{$projectRoot}/header.php";
|
||||
|
||||
if ( $argc != 2 ) {
|
||||
if ( $argc == 1 ) {
|
||||
$daysToKeep = 10;
|
||||
} else {
|
||||
$daysToKeep = intval($argv[1]);
|
||||
}
|
||||
|
||||
$dryrun = (in_array("--dryrun", $argv)) ? true : false;
|
||||
|
||||
$ed = $projectRoot . "/" . EXTRACTSDIR;
|
||||
$now = time();
|
||||
$maxAge = $now - (86400*$daysToKeep);
|
||||
|
|
@ -21,7 +23,7 @@ foreach ( $files as $file ) {
|
|||
if ( $file->isDir() && in_array($file->getExtension(), $validExtensions) ) {
|
||||
if ( filemtime($file->getRealPath()) <= $maxAge ) {
|
||||
echo "Found aged extracted comic: {$file->getFilename()}\n";
|
||||
exec("rm -rf \"{$file->getRealPath()}\"", $output, $retval);
|
||||
if ( !$dryrun ) exec("rm -rf \"{$file->getRealPath()}\"", $output, $retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ a, a:link, a:visited, a:active {
|
|||
text-align: center;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
border-bottom: 2px solid var(--default-color);
|
||||
border-bottom: 2px solid var(--foreground-color);
|
||||
}
|
||||
.sorter {
|
||||
float: left;
|
||||
|
|
@ -65,7 +65,7 @@ a, a:link, a:visited, a:active {
|
|||
width: 330px;
|
||||
height: 495px;
|
||||
margin: 5px;
|
||||
border: 2px solid var(--default-color);
|
||||
border: 2px solid var(--foreground-color);
|
||||
padding: 2px;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@
|
|||
<link rel="apple-touch-icon" sizes="512x512" href="img/comics_512.png" />
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
<title>JAJ Comics</title>
|
||||
<link rel='stylesheet' type='text/css' href='css/reset.css' media='screen' />
|
||||
<link rel='stylesheet' type='text/css' href='css/comics.css' media='screen' />
|
||||
<link rel="stylesheet" type="text/css" href="core/simpleLightbox.min.css" />
|
||||
<!-- <link rel="stylesheet" type="text/css" href="core/simple-lightbox.min.css" /> -->
|
||||
<link rel="stylesheet" type="text/css" href="core/toastr.css" />
|
||||
<link rel='stylesheet' type='text/css' href='css/reset.css' media='screen' />
|
||||
<link rel='stylesheet' type='text/css' href='css/comics.css' media='screen' />
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
Description="A script to remove extracted comics in webapp older than a set age (defaults to 10 days)"
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/php /var/www/htdocs/comics/cron/clearExtracts.php
|
||||
ExecStart=/usr/bin/php /var/www/htdocs/comics/cron/clearextracts.php
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user