Fixes some minor bugs (#11)
Jeremy D

Jeremy D commited on 2023-03-31 17:22:51
Showing 3 changed files, with 27 additions and 6 deletions.


Fixes #8
Fixes #9
... ...
@@ -28,7 +28,7 @@ class DevTools
28 28
 	private array $smcFunc;
29 29
 	/* This is array in "theory" only.  SMF sometimes will null this when pulling from cache and causes an error */
30 30
 	private ?array $modSettings;
31
-	private array $txt;
31
+	private ?array $txt;
32 32
 	/* Sometimes in SMF, this is null, which is unusal for a boolean */
33 33
 	private ?bool $db_show_debug;
34 34
 
... ...
@@ -39,6 +39,11 @@ class DevToolsFiles
39 39
 	*/
40 40
 	private string $packageInfoName = 'package-info.xml';
41 41
 
42
+	/*
43
+	 * This is the package id of dev tools, used to hide itself from being modified with under normal circumstances
44
+	*/
45
+	private string $devToolsPackageID = 'sleepy:devtools';
46
+
42 47
 	/*
43 48
 	 * The extensions we support.
44 49
 	*/
... ...
@@ -246,13 +251,14 @@ class DevToolsFiles
246 251
 		// Handle some substitutions.
247 252
 		$infoVersion = $this->findPackageInfoVersion($infoFile);
248 253
 		$infoName = $this->findPackageInfoName($infoFile);
254
+
249 255
 		$packageName = strtr($packageName, [
250
-			'{VERSION}' => $infoVersion,
256
+			'{CUSTOMIZATION-NAME}' => preg_replace('~\s~i', '-', $infoName),
257
+			'{CUSTOMIZATION_NAME}' => preg_replace('~\s~i', '_', $infoName),
258
+			'{CUSTOMIZATION NAME}' => $infoName,
251 259
 			'{VERSION-}' => str_replace('.', '-', $infoVersion),
252 260
 			'{VERSION_}' => str_replace('.', '_', $infoVersion),
253
-			'{CUSTOMIZATION-NAME}' => preg_replace('~\s~i', '-', $packageName),
254
-			'{CUSTOMIZATION_NAME}' => preg_replace('~\s~i', '_', $packageName),
255
-			'{CUSTOMIZATION NAME}' => $packageName,
261
+			'{VERSION}' => $infoVersion,
256 262
 		]);
257 263
 
258 264
 		$className = 'DevToolsFile' . mb_convert_case($this->getRequestProvider(), MB_CASE_TITLE, 'UTF-8') . mb_convert_case($this->getRequestedExtension(), MB_CASE_TITLE, 'UTF-8');
... ...
@@ -2,9 +2,15 @@
2 2
 <package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
3 3
 	<id>sleepy:devtools</id>
4 4
 	<name>Developer Tools</name>
5
-	<version>1.1</version>
5
+	<version>1.1.1</version>
6 6
 	<type>modification</type>
7 7
 
8
+	<upgrade from="1.1" for="2.1.*">
9
+		<require-file name="DevTools.php" destination="$sourcedir" />
10
+		<require-file name="DevTools/DevTools-File.php" destination="$sourcedir/DevTools" />
11
+		<require-file name="languages/DevTools.russian.php" destination="$themes_dir/default/languages" />
12
+	</upgrade>
13
+
8 14
 	<upgrade from="1.0.*" for="2.1.*">
9 15
 		<require-file name="DevTools.php" destination="$sourcedir" />
10 16
 		<require-dir name="DevTools" destination="$sourcedir" />
... ...
@@ -58,4 +64,13 @@
58 64
 		<remove-file name="$sourcedir/DevTools.php" />
59 65
 		<remove-dir destination="$sourcedir/DevTools" />
60 66
 	</uninstall>
67
+
68
+	<devtools>
69
+		<packagename>{CUSTOMIZATION-NAME}_{VERSION}</packagename>
70
+		<exclusion>.git</exclusion>
71
+		<exclusion>.github</exclusion>
72
+		<exclusion>.scrutinizer.yml</exclusion>
73
+		<exclusion>screenshots</exclusion>
74
+		<exclusion>SECURITY.md</exclusion>
75
+	</devtools>
61 76
 </package-info>
62 77
\ No newline at end of file
63 78