]> git.mxchange.org Git - friendica.git/commitdiff
Item cache related functionality removed
authorMichael <heluecht@pirati.ca>
Mon, 5 Jul 2021 04:57:50 +0000 (04:57 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 5 Jul 2021 04:57:50 +0000 (04:57 +0000)
boot.php
src/Core/System.php
src/Module/Admin/Site.php
src/Worker/ClearCache.php
static/defaults.config.php
tests/src/Content/Text/BBCodeTest.php
view/templates/admin/site.tpl
view/theme/frio/templates/admin/site.tpl
view/theme/smoothly/style.css

index e94b82fa38c647437ae8e678337060ceb03e244d..b3b560a0963f0be40495966d4a6a5030bb8eee73 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -444,93 +444,6 @@ function get_temppath()
        return '';
 }
 
-function get_cachefile($file, $writemode = true)
-{
-       $cache = get_itemcachepath();
-
-       if ((!$cache) || (!is_dir($cache))) {
-               return "";
-       }
-
-       $subfolder = $cache . "/" . substr($file, 0, 2);
-
-       $cachepath = $subfolder . "/" . $file;
-
-       if ($writemode) {
-               if (!is_dir($subfolder)) {
-                       mkdir($subfolder);
-                       chmod($subfolder, 0777);
-               }
-       }
-
-       return $cachepath;
-}
-
-function clear_cache($basepath = "", $path = "")
-{
-       if ($path == "") {
-               $basepath = get_itemcachepath();
-               $path = $basepath;
-       }
-
-       if (($path == "") || (!is_dir($path))) {
-               return;
-       }
-
-       if (substr(realpath($path), 0, strlen($basepath)) != $basepath) {
-               return;
-       }
-
-       $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
-       if ($cachetime == 0) {
-               $cachetime = 86400;
-       }
-
-       if (is_writable($path)) {
-               if ($dh = opendir($path)) {
-                       while (($file = readdir($dh)) !== false) {
-                               $fullpath = $path . "/" . $file;
-                               if ((filetype($fullpath) == "dir") && ($file != ".") && ($file != "..")) {
-                                       clear_cache($basepath, $fullpath);
-                               }
-                               if ((filetype($fullpath) == "file") && (filectime($fullpath) < (time() - $cachetime))) {
-                                       unlink($fullpath);
-                               }
-                       }
-                       closedir($dh);
-               }
-       }
-}
-
-function get_itemcachepath()
-{
-       // Checking, if the cache is deactivated
-       $cachetime = (int) DI::config()->get('system', 'itemcache_duration');
-       if ($cachetime < 0) {
-               return "";
-       }
-
-       $itemcache = DI::config()->get('system', 'itemcache');
-       if (($itemcache != "") && System::isDirectoryUsable($itemcache)) {
-               return BasePath::getRealPath($itemcache);
-       }
-
-       $temppath = get_temppath();
-
-       if ($temppath != "") {
-               $itemcache = $temppath . "/itemcache";
-               if (!file_exists($itemcache) && !is_dir($itemcache)) {
-                       mkdir($itemcache);
-               }
-
-               if (System::isDirectoryUsable($itemcache)) {
-                       DI::config()->set("system", "itemcache", $itemcache);
-                       return $itemcache;
-               }
-       }
-       return "";
-}
-
 /**
  * Returns the path where spool files are stored
  *
index 5069a4a9800c6e8da47848bf97f03c727bec6154..c61225e482e92b70a54f2e1b644f38d12a57ef27 100644 (file)
@@ -329,8 +329,6 @@ class System
        function info($s)
        function is_site_admin()
        function get_temppath()
-       function get_cachefile($file, $writemode = true)
-       function get_itemcachepath()
        function get_spoolpath()
        */
 }
index a04b4194df4f921967c7699a4e9ae9237455dc28..3dde6c1242d9a018fcca016ed72cc79da56ee2d4 100644 (file)
@@ -194,8 +194,6 @@ class Site extends BaseAdmin
                $dbclean_unclaimed      = (!empty($_POST['dbclean_unclaimed'])      ? intval($_POST['dbclean_unclaimed'])             : 0);
                $dbclean_expire_conv    = (!empty($_POST['dbclean_expire_conv'])    ? intval($_POST['dbclean_expire_conv'])           : 0);
                $suppress_tags          = !empty($_POST['suppress_tags']);
-               $itemcache              = (!empty($_POST['itemcache'])              ? Strings::escapeTags(trim($_POST['itemcache']))  : '');
-               $itemcache_duration     = (!empty($_POST['itemcache_duration'])     ? intval($_POST['itemcache_duration'])            : 0);
                $max_comments           = (!empty($_POST['max_comments'])           ? intval($_POST['max_comments'])                  : 0);
                $max_display_comments   = (!empty($_POST['max_display_comments'])   ? intval($_POST['max_display_comments'])          : 0);
                $temppath               = (!empty($_POST['temppath'])               ? Strings::escapeTags(trim($_POST['temppath']))   : '');
@@ -395,12 +393,6 @@ class Site extends BaseAdmin
 
                DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
 
-               if ($itemcache != '') {
-                       $itemcache = BasePath::getRealPath($itemcache);
-               }
-
-               DI::config()->set('system', 'itemcache', $itemcache);
-               DI::config()->set('system', 'itemcache_duration', $itemcache_duration);
                DI::config()->set('system', 'max_comments', $max_comments);
                DI::config()->set('system', 'max_display_comments', $max_display_comments);
 
@@ -506,7 +498,6 @@ class Site extends BaseAdmin
 
                // Automatically create temporary paths
                get_temppath();
-               get_itemcachepath();
 
                /* Register policy */
                $register_choices = [
@@ -674,8 +665,6 @@ class Site extends BaseAdmin
                        '$dbclean_expire_days'    => ['dbclean_expire_days', DI::l10n()->t('Lifespan of remote items'), DI::config()->get('system', 'dbclean-expire-days'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
                        '$dbclean_unclaimed'      => ['dbclean_unclaimed', DI::l10n()->t('Lifespan of unclaimed items'), DI::config()->get('system', 'dbclean-expire-unclaimed'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
                        '$dbclean_expire_conv'    => ['dbclean_expire_conv', DI::l10n()->t('Lifespan of raw conversation data'), DI::config()->get('system', 'dbclean_expire_conversation'), DI::l10n()->t('The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
-                       '$itemcache'              => ['itemcache', DI::l10n()->t('Path to item cache'), DI::config()->get('system', 'itemcache'), DI::l10n()->t('The item caches buffers generated bbcode and external images.')],
-                       '$itemcache_duration'     => ['itemcache_duration', DI::l10n()->t('Cache duration in seconds'), DI::config()->get('system', 'itemcache_duration'), DI::l10n()->t('How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.')],
                        '$max_comments'           => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), DI::config()->get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')],
                        '$max_display_comments'   => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
                        '$temppath'               => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
index 5b71c2f8be328a281500ca423514157c6aec5aa8..baf15387da5b4ece7092a9d2dbaf2f1acc3ae355 100644 (file)
@@ -38,29 +38,6 @@ class ClearCache
                // clear old cache
                DI::cache()->clear();
 
-               // clear old item cache files
-               clear_cache();
-
-               // clear cache for photos
-               clear_cache($a->getBasePath(), $a->getBasePath() . "/photo");
-
-               // clear smarty cache
-               clear_cache($a->getBasePath() . "/view/smarty3/compiled", $a->getBasePath() . "/view/smarty3/compiled");
-
-               // clear cache for image proxy
-               if (!DI::config()->get("system", "proxy_disabled")) {
-                       clear_cache($a->getBasePath(), $a->getBasePath() . "/proxy");
-
-                       $cachetime = DI::config()->get('system', 'proxy_cache_time');
-
-                       if (!$cachetime) {
-                               $cachetime = ProxyUtils::DEFAULT_TIME;
-                       }
-
-                       $condition = ['`uid` = 0 AND `resource-id` LIKE "pic:%" AND `created` < NOW() - INTERVAL ? SECOND', $cachetime];
-                       Photo::delete($condition);
-               }
-
                // Delete the cached OEmbed entries that are older than three month
                DBA::delete('oembed', ["`created` < NOW() - INTERVAL 3 MONTH"]);
 
index 25a23bf9dd64a9cdcccaf99c2cad6bd677dbb6ca..20f351ab0eb66abec63cbc69af9c3f8519f039ae 100644 (file)
@@ -570,10 +570,6 @@ return [
                // xrd_timeout (Integer)
                // Timeout in seconds for fetching the XRD links.
                'xrd_timeout' => 20,
-
-               // proxy_file_chmod (Octal Integer like 0640)
-               // If set, defines the files permissions for downloaded files in the /proxy/ directory, default is system-dependent
-               'proxy_file_chmod' => 0,
        ],
        'experimental' => [
                // exp_themes (Boolean)
index 46f153edc2349152cc221a27d072bf9a25dc6546..2b5dc22a19e26000d9a9063a9827e21544b5a918 100644 (file)
@@ -51,9 +51,6 @@ class BBCodeTest extends MockedTest
                $this->configMock->shouldReceive('get')
                        ->with('system', 'allowed_link_protocols')
                        ->andReturn(null);
-               $this->configMock->shouldReceive('get')
-                       ->with('system', 'itemcache_duration')
-                       ->andReturn(-1);
                $this->configMock->shouldReceive('get')
                        ->with('system', 'url')
                        ->andReturn('friendica.local');
index 75d9437d78f1ddc1aa47b52d176b5aedba042206..9405992005ec8bc68f550c70ec5667ef0a5daaa1 100644 (file)
 
                <h2>{{$performance}}</h2>
                {{include file="field_checkbox.tpl" field=$only_tag_search}}
-               {{include file="field_input.tpl" field=$itemcache}}
-               {{include file="field_input.tpl" field=$itemcache_duration}}
                {{include file="field_input.tpl" field=$max_comments}}
                {{include file="field_input.tpl" field=$max_display_comments}}
                {{include file="field_checkbox.tpl" field=$proxy_disabled}}
index 69076833dd7f0b5dd4835040f57fcfe1b21c8a5b..97d5907a6500578e0a43acc921620d83279ecb96 100644 (file)
                                <div id="admin-settings-performance-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-performance">
                                        <div class="panel-body">
                                                {{include file="field_checkbox.tpl" field=$only_tag_search}}
-                                               {{include file="field_input.tpl" field=$itemcache}}
-                                               {{include file="field_input.tpl" field=$itemcache_duration}}
                                                {{include file="field_input.tpl" field=$max_comments}}
                                                {{include file="field_input.tpl" field=$max_display_comments}}
                                                {{include file="field_checkbox.tpl" field=$proxy_disabled}}
index 207aebbef2e88630d4ede0819dd9df1e9b248470..ac0179ea747ffa8a32532d9f0084a2e6074ee62e 100644 (file)
@@ -4620,7 +4620,6 @@ div #datebrowse-sidebar.widget {
        margin: 25px 0 25px 0;
 }
 
-#id_itemcache,
 #id_basepath,
 #id_temppath,
 #id_lockpath,
@@ -4633,7 +4632,6 @@ div #datebrowse-sidebar.widget {
        width: 440px;
 }
 
-#id_itemcache_duration,
 #id_abandon_days,
 #id_maxloadavg,
 #id_poll_interval,