Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5213bd4e6e | ||
| 8ab3f57894 | |||
|
|
1431c72909 | ||
| 9f3e1b7017 | |||
| de13c42a13 |
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.2",
|
"version": "2.0.4",
|
||||||
"author": "Ivan Carlos",
|
"author": "Ivan Carlos",
|
||||||
"upstream_sha": ""
|
"upstream_sha": ""
|
||||||
}
|
}
|
||||||
|
|||||||
69
plugin.php
69
plugin.php
@@ -527,8 +527,8 @@ function icc_upload_and_shorten_do_page()
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label><strong>Diagnostics:</strong></label><br />
|
<label><strong>Diagnostics:</strong></label><br />
|
||||||
<a href="javascript:void(0);" onclick="document.getElementById('icc_cleanup_form').submit();" class="button">Run Cleanup & Diagnostics Now</a>
|
<a href="javascript:void(0);" onclick="document.getElementById(\'icc_cleanup_form\').submit();" class="button">Run Cleanup & Diagnostics Now</a>
|
||||||
<small> (Checks for 'icc_temp_' folders older than 24 hours and attempts to delete them)</small>
|
<small> (Checks for \'icc_temp_\' folders older than 24 hours and attempts to delete them)</small>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><input type="submit" value="Save Configuration" class="button-primary" /></p>
|
<p><input type="submit" value="Save Configuration" class="button-primary" /></p>
|
||||||
@@ -673,45 +673,46 @@ function icc_upload_and_shorten_local_file_manager($dir, $url)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive directory removal
|
}
|
||||||
function icc_rrmdir($dir)
|
|
||||||
{
|
// Recursive directory removal
|
||||||
if (is_dir($dir)) {
|
function icc_rrmdir($dir)
|
||||||
$objects = scandir($dir);
|
{
|
||||||
foreach ($objects as $object) {
|
if (is_dir($dir)) {
|
||||||
if ($object != "." && $object != "..") {
|
$objects = scandir($dir);
|
||||||
if (is_dir($dir . "/" . $object) && !is_link($dir . "/" . $object))
|
foreach ($objects as $object) {
|
||||||
icc_rrmdir($dir . "/" . $object);
|
if ($object != "." && $object != "..") {
|
||||||
else
|
if (is_dir($dir . "/" . $object) && !is_link($dir . "/" . $object))
|
||||||
unlink($dir . "/" . $object);
|
icc_rrmdir($dir . "/" . $object);
|
||||||
}
|
else
|
||||||
|
unlink($dir . "/" . $object);
|
||||||
}
|
}
|
||||||
rmdir($dir);
|
|
||||||
}
|
}
|
||||||
|
rmdir($dir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup Temp Folders
|
// Cleanup Temp Folders
|
||||||
function icc_upload_and_shorten_cleanup_temp()
|
function icc_upload_and_shorten_cleanup_temp()
|
||||||
{
|
{
|
||||||
$temp_dir = yourls_get_option('icc_upload_share_dir');
|
$temp_dir = yourls_get_option('icc_upload_share_dir');
|
||||||
if (!$temp_dir)
|
if (!$temp_dir)
|
||||||
$temp_dir = sys_get_temp_dir();
|
$temp_dir = sys_get_temp_dir();
|
||||||
|
|
||||||
if (!is_dir($temp_dir))
|
if (!is_dir($temp_dir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Scan for icc_temp_* directories
|
// Scan for icc_temp_* directories
|
||||||
$files = scandir($temp_dir);
|
$files = scandir($temp_dir);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file == '.' || $file == '..')
|
if ($file == '.' || $file == '..')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$path = rtrim($temp_dir, '/') . '/' . $file;
|
$path = rtrim($temp_dir, '/') . '/' . $file;
|
||||||
if (is_dir($path) && strpos($file, 'icc_temp_') === 0) {
|
if (is_dir($path) && strpos($file, 'icc_temp_') === 0) {
|
||||||
// Check age (1 hour = 3600 seconds)
|
// Check age (1 hour = 3600 seconds)
|
||||||
if (filemtime($path) < (time() - 86400)) {
|
if (filemtime($path) < (time() - 86400)) {
|
||||||
icc_rrmdir($path);
|
icc_rrmdir($path);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user