Compare commits
5 Commits
078ea8d4fa
...
6460cfca37
| Author | SHA1 | Date | |
|---|---|---|---|
| 6460cfca37 | |||
| ee02a15182 | |||
| dca541c6b8 | |||
| b55e3c1d92 | |||
| 7aecf00971 |
|
|
@ -47,11 +47,21 @@ if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
||||||
}
|
}
|
||||||
$data["startindex"] = $currentpage;
|
$data["startindex"] = $currentpage;
|
||||||
|
|
||||||
|
$extracted = false;
|
||||||
if ( !is_dir($comicoutputfull) ) {
|
if ( !is_dir($comicoutputfull) ) {
|
||||||
mkdir($comicoutputfull, 0755, true);
|
mkdir($comicoutputfull, 0755, true);
|
||||||
|
} else {
|
||||||
|
touch($comicoutputfull);
|
||||||
|
$extracted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = array();
|
$files = array();
|
||||||
|
if ( $extracted ) {
|
||||||
|
$contents = glob($comicoutputfull . "*");
|
||||||
|
foreach ( $contents as $i ) {
|
||||||
|
$files[] = basename($i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ( $ext == "cbz" ) {
|
if ( $ext == "cbz" ) {
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$opened = $zip->open($comicfull);
|
$opened = $zip->open($comicfull);
|
||||||
|
|
@ -83,6 +93,7 @@ if ( $ext == "cbz" ) {
|
||||||
} else {
|
} else {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
natsort($files);
|
natsort($files);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ $projectRoot = dirname(dirname(__FILE__));
|
||||||
|
|
||||||
require "{$projectRoot}/header.php";
|
require "{$projectRoot}/header.php";
|
||||||
|
|
||||||
if ( $argc != 2 ) {
|
if ( $argc == 1 ) {
|
||||||
$daysToKeep = 10;
|
$daysToKeep = 10;
|
||||||
} else {
|
} else {
|
||||||
$daysToKeep = intval($argv[1]);
|
$daysToKeep = intval($argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dryrun = (in_array("--dryrun", $argv)) ? true : false;
|
||||||
|
|
||||||
$ed = $projectRoot . "/" . EXTRACTSDIR;
|
$ed = $projectRoot . "/" . EXTRACTSDIR;
|
||||||
$now = time();
|
$now = time();
|
||||||
$maxAge = $now - (86400*$daysToKeep);
|
$maxAge = $now - (86400*$daysToKeep);
|
||||||
|
|
@ -21,7 +23,7 @@ foreach ( $files as $file ) {
|
||||||
if ( $file->isDir() && in_array($file->getExtension(), $validExtensions) ) {
|
if ( $file->isDir() && in_array($file->getExtension(), $validExtensions) ) {
|
||||||
if ( filemtime($file->getRealPath()) <= $maxAge ) {
|
if ( filemtime($file->getRealPath()) <= $maxAge ) {
|
||||||
echo "Found aged extracted comic: {$file->getFilename()}\n";
|
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;
|
text-align: center;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
border-bottom: 2px solid var(--default-color);
|
border-bottom: 2px solid var(--foreground-color);
|
||||||
}
|
}
|
||||||
.sorter {
|
.sorter {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
@ -65,7 +65,7 @@ a, a:link, a:visited, a:active {
|
||||||
width: 330px;
|
width: 330px;
|
||||||
height: 495px;
|
height: 495px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border: 2px solid var(--default-color);
|
border: 2px solid var(--foreground-color);
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
<link rel="apple-touch-icon" sizes="512x512" href="img/comics_512.png" />
|
<link rel="apple-touch-icon" sizes="512x512" href="img/comics_512.png" />
|
||||||
<link rel="manifest" href="manifest.json" />
|
<link rel="manifest" href="manifest.json" />
|
||||||
<title>JAJ Comics</title>
|
<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/simpleLightbox.min.css" />
|
||||||
<!-- <link rel="stylesheet" type="text/css" href="core/simple-lightbox.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="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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
Description="A script to remove extracted comics in webapp older than a set age (defaults to 10 days)"
|
Description="A script to remove extracted comics in webapp older than a set age (defaults to 10 days)"
|
||||||
|
|
||||||
[Service]
|
[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