Skip to content

Commit 6709d00

Browse files
authored
Fix static analysis warnings for isDot() and remove deprecated APC support (#1164)
* Fix static analysis warnings for isDot() * Remove deprecated APC support * Remove redundant isDot() check and fix static analysis warnings
1 parent aa6edc3 commit 6709d00

File tree

7 files changed

+6
-157
lines changed

7 files changed

+6
-157
lines changed

src/Cacheresource/File.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ public function storeCachedContent(Template $_template, $content)
127127
&& (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1
128128
) {
129129
opcache_invalidate($_template->getCached()->filepath, true);
130-
} elseif (function_exists('apc_compile_file')) {
131-
apc_compile_file($_template->getCached()->filepath);
132130
}
133131
$cached = $_template->getCached();
134132
$cached->timestamp = $cached->exists = is_file($cached->filepath);
@@ -223,10 +221,8 @@ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $e
223221
$_filepath = (string)$_file;
224222
// directory ?
225223
if ($_file->isDir()) {
226-
if (!$_cache->isDot()) {
227-
// delete folder if empty
228-
@rmdir($_file->getPathname());
229-
}
224+
// delete folder if empty
225+
@rmdir($_file->getPathname());
230226
} else {
231227
// delete only php files
232228
if (substr($_filepath, -4) !== '.php') {
@@ -279,8 +275,6 @@ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $e
279275
&& (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
280276
) {
281277
opcache_invalidate($_filepath, true);
282-
} elseif (function_exists('apc_delete_file')) {
283-
apc_delete_file($_filepath);
284278
}
285279
}
286280
}

src/Smarty.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,10 +1344,8 @@ public function clearCompiledTemplate($resource_name = null, $compile_id = null,
13441344
}
13451345
$_filepath = (string)$_file;
13461346
if ($_file->isDir()) {
1347-
if (!$_compile->isDot()) {
1348-
// delete folder if empty
1349-
@rmdir($_file->getPathname());
1350-
}
1347+
// delete folder if empty
1348+
@rmdir($_file->getPathname());
13511349
} else {
13521350
// delete only php files
13531351
if (substr($_filepath, -4) !== '.php') {
@@ -1385,8 +1383,6 @@ public function clearCompiledTemplate($resource_name = null, $compile_id = null,
13851383
&& (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api')) < 1)
13861384
) {
13871385
opcache_invalidate($_filepath, true);
1388-
} elseif (function_exists('apc_delete_file')) {
1389-
apc_delete_file($_filepath);
13901386
}
13911387
}
13921388
}

src/Template/Compiled.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ private function loadCompiledTemplate(Template $_smarty_tpl, bool $invalidateCac
251251
&& (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
252252
) {
253253
opcache_invalidate($this->filepath, true);
254-
} elseif (function_exists('apc_compile_file')) {
255-
apc_compile_file($this->filepath);
256254
}
257255
}
258256
if (defined('HHVM_VERSION')) {

tests/PHPUnit_Smarty.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,8 @@ public function cleanDir($dir)
291291
}
292292
// directory ?
293293
if ($file->isDir()) {
294-
if (!$ri->isDot()) {
295-
// delete folder if empty
296-
@rmdir($file->getPathname());
297-
}
294+
// delete folder if empty
295+
@rmdir($file->getPathname());
298296
} else {
299297
unlink($file->getPathname());
300298
}

tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/UnitTests/CacheResourceTests/_shared/PHPunitplugins/cacheresource.apctest.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/UnitTests/__shared/cacheresources/cacheresource.apc.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)