Fix a issue where we couldn't see some hooks due to hiding dev tools hooks
jdarwood007

jdarwood007 commited on 2023-09-22 16:55:56
Showing 3 changed files, with 9 additions and 4 deletions.

... ...
@@ -298,7 +298,7 @@ class DevToolsHooks
298 298
 			array_filter(
299 299
 				$this->modSettings,
300 300
 				function ($value, $key) {
301
-					return substr($key, 0, 10) === 'integrate_' && !empty($value) && (!empty($this->modSettings['dt_showAllHooks']) || strpos($value, 'DevTools') === false);
301
+					return substr($key, 0, 10) === 'integrate_' && !empty($value);
302 302
 				},
303 303
 				ARRAY_FILTER_USE_BOTH
304 304
 			)
... ...
@@ -308,6 +308,9 @@ class DevToolsHooks
308 308
 		foreach ($temp as $hookName => $rawFuncs)
309 309
 			foreach ($rawFuncs as $func)
310 310
 			{
311
+				if (empty($this->modSettings['dt_showAllHooks']) && stripos($func, 'DevTools') !== false)
312
+					continue;
313
+
311 314
 				$hookParsedData = parse_integration_hook($hookName, $func);
312 315
 
313 316
 				$hooks[] = [
... ...
@@ -597,7 +597,7 @@ class DevToolsPackages
597 597
 		// package_put/get_contents in Subs-Package.php
598 598
 		return array_map(function($op) use ($src, $dst) {
599 599
 			// Let us know the writable status.
600
-			$op['isw'] = package_chmod($op[$dst]);
600
+			$op['isw'] = !package_chmod($op[$dst]);
601 601
 
602 602
 			if (is_dir($op[$src]))
603 603
 				$op['res'] = copytree($op[$src], $op[$dst]);
... ...
@@ -2,12 +2,14 @@
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.2</version>
5
+	<version>1.1.3</version>
6 6
 	<type>modification</type>
7 7
 
8
-	<upgrade from="1.1-1.1.1" for="2.1.*">
8
+	<upgrade from="1.1-1.1.2" for="2.1.*">
9 9
 		<require-file name="DevTools.php" destination="$sourcedir" />
10 10
 		<require-file name="DevTools/DevTools-File.php" destination="$sourcedir/DevTools" />
11
+		<require-file name="DevTools/DevTools-Hooks.php" destination="$sourcedir/DevTools" />
12
+		<require-file name="DevTools/DevTools-Packages.php" destination="$sourcedir/DevTools" />
11 13
 		<require-file name="languages/DevTools.russian.php" destination="$themes_dir/default/languages" />
12 14
 	</upgrade>
13 15
 
14 16