Browse Source

added migration of old cache folder to data folder

CauseFX 4 years ago
parent
commit
8230656525
3 changed files with 19 additions and 4 deletions
  1. 1 1
      api/classes/organizr.class.php
  2. 17 2
      api/functions/upgrade-functions.php
  3. 1 1
      js/version.json

+ 1 - 1
api/classes/organizr.class.php

@@ -64,7 +64,7 @@ class Organizr
 
 	// ===================================
 	// Organizr Version
-	public $version = '2.1.1400';
+	public $version = '2.1.1500';
 	// ===================================
 	// Quick php Version check
 	public $minimumPHP = '7.3';

+ 17 - 2
api/functions/upgrade-functions.php

@@ -73,7 +73,7 @@ trait UpgradeFunctions
 			}
 			// End Upgrade check start for version above
 			// Upgrade check start for version below
-			$versionCheck = '2.1.1400';
+			$versionCheck = '2.1.1500';
 			if ($compare->lessThan($oldVer, $versionCheck)) {
 				$updateDB = false;
 				$oldVer = $versionCheck;
@@ -233,7 +233,7 @@ trait UpgradeFunctions
 				$this->removeOldCustomHTML();
 			case '2.1.860':
 				$this->upgradeInstalledPluginsConfigItem();
-			case '2.1.1400':
+			case '2.1.1500':
 				$this->upgradeDataToFolder();
 			default:
 				$this->setAPIResponse('success', 'Ran update function for version: ' . $version, 200);
@@ -241,6 +241,19 @@ trait UpgradeFunctions
 		}
 	}
 
+	public function removeOldCacheFolder()
+	{
+		$folder = $this->root . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
+		$this->setLoggerChannel('Migration');
+		$this->logger->info('Running Old Cache folder migration');
+		if (file_exists($folder)) {
+			$this->rrmdir($folder);
+			$this->logger->info('Old Cache folder found');
+			$this->logger->info('Removed Old Cache folder');
+		}
+		return true;
+	}
+
 	public function upgradeDataToFolder()
 	{
 		if ($this->hasDB()) {
@@ -320,6 +333,8 @@ trait UpgradeFunctions
 						$this->logger->info('Custom routes was migrated over');
 					}
 				}
+				// Migrate over cache folder
+				$this->removeOldCacheFolder();
 			}
 			return true;
 		}

+ 1 - 1
js/version.json

@@ -489,7 +489,7 @@
     "fixed": "fixed error logging on cron file using wrong function|fixed issue with socks api not forwarding content type if set|fixed Organizr sending invalid API query to Sonarr caused by non-conversion of boolean (#1750)|fixed radarr queue combining issue|fixed sonarr queue title issue|fixed type error not being set",
     "notes": "moved plex bandwidth tooltip to bottom|set auth function to return 401 if organizr is not setup or an error has occurred|spacing on organizr class file|Updated the following languages: [Polish] [Russian]|Update links in read me"
   },
-  "2.1.1400": {
+  "2.1.1500": {
     "date": "2022-01-26 19:25",
     "title": "",
     "new": "added \"href\" and \"icon\" to lidarr.php|added \"href\" and \"icon\" to radarr.php|added bg-bookmark as well|added bg-bookmarks to organizr.css|added check for url to see if null as well as null string value|added chooseConfigFile for the process of moving the config file|added config items update to info log|added css to marketplace logo if logo is broken|added data/config to gitignore|added debug logger message to authProxy range check|added direct Sonarr/Radarr/Lidarr button link to calendar modal|added folder to buildFormItem function|added folder to settingsOption function|added in check to see if url is organizr type to bypass url format|added log-settings to shortcut function|added logLocation and dbLocation to updateConfigItems function to cleanDirectory|added logLocation to logFunctions trait file|added logLocation to log settings|added log settings button to log viewer|added m-b-0 class to tab and category table|added m-t-0 class to loading settings well|added makeDir to normal-functions.php file|added makeDir to setOrganizrLog function|added more checks for https protocol on proxies|Added more time zone conversions|added new data folder to gitignore file|added new logo-purple image|added organizr-auth api endpoint|added placeholder to added new tab page|added test/folder api endpoint|added testFolder function|added upgradeDataToFolder to upgrade script|added url check to tab urls|Adding \"href\" and \"icon\" to sonarr.php|Adding buildPVRLink, updating buildCalendarMetadata()|Adding time zone conversions|Adding Western European Timezone|re-added livetv to plex resolve item|Updated calendarStandardizeTimezone to address (#1772)",