@@ -461,7 +461,9 @@ public function installTest(): void
461461 'failed ' => true ,
462462 ];
463463 } else {
464- if ($ action ['boardmod ' ]) {
464+ if ($ action ['diff ' ]) {
465+ $ mod_actions = PackageUtils::parseDiff (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), true , $ action ['reverse ' ], $ theme_paths );
466+ } elseif ($ action ['boardmod ' ]) {
465467 $ mod_actions = PackageUtils::parseBoardMod (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), true , $ action ['reverse ' ], $ theme_paths );
466468 } else {
467469 $ mod_actions = PackageUtils::parseModification (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), true , $ action ['reverse ' ], $ theme_paths );
@@ -540,6 +542,27 @@ public function installTest(): void
540542 'description ' => Lang::getTxt ('package_action_error ' , file: 'Packages ' ),
541543 'failed ' => true ,
542544 ];
545+ } elseif ($ mod_action ['type ' ] == 'create-file ' ) {
546+ Utils::$ context ['actions ' ][$ actual_filename ] = [
547+ 'type ' => Lang::$ txt ['package_create_file ' ],
548+ 'action ' => Utils::htmlspecialchars (strtr ($ mod_action ['filename ' ], [Config::$ boarddir => '. ' ])),
549+ 'description ' => $ failed ? Lang::$ txt ['package_action_failure ' ] : '' ,
550+ 'failed ' => $ failed ,
551+ ];
552+ } elseif ($ mod_action ['type ' ] == 'move-file ' ) {
553+ Utils::$ context ['actions ' ][$ actual_filename ] = [
554+ 'type ' => Lang::$ txt ['package_move_file ' ],
555+ 'action ' => Utils::htmlspecialchars (strtr ($ mod_action ['source ' ], [Config::$ boarddir => '. ' ])) . ' => ' . Utils::htmlspecialchars (strtr ($ mod_action ['destination ' ], [Config::$ boarddir => '. ' ])),
556+ 'description ' => $ failed ? Lang::$ txt ['package_action_missing ' ] : '' ,
557+ 'failed ' => $ failed ,
558+ ];
559+ } elseif ($ mod_action ['type ' ] == 'remove-file ' ) {
560+ Utils::$ context ['actions ' ][$ actual_filename ] = [
561+ 'type ' => Lang::$ txt ['package_delete_file ' ],
562+ 'action ' => Utils::htmlspecialchars (strtr ($ mod_action ['filename ' ], [Config::$ boarddir => '. ' ])),
563+ 'description ' => $ failed ? Lang::$ txt ['package_action_missing ' ] : '' ,
564+ 'failed ' => $ failed ,
565+ ];
543566 }
544567 }
545568
@@ -555,7 +578,16 @@ public function installTest(): void
555578 }
556579
557580 // We just need it for actual parse changes.
558- if (!in_array ($ mod_action ['type ' ], ['error ' , 'result ' , 'opened ' , 'saved ' , 'end ' , 'missing ' , 'skipping ' , 'chmod ' ])) {
581+ if (!in_array ($ mod_action ['type ' ], ['error ' , 'result ' , 'opened ' , 'saved ' , 'end ' , 'missing ' , 'skipping ' , 'chmod ' , 'create-file ' , 'move-file ' , 'remove-file ' ])) {
582+ if (!isset (Utils::$ context ['actions ' ][$ actual_filename ])) {
583+ Utils::$ context ['actions ' ][$ actual_filename ] = [
584+ 'type ' => Lang::$ txt ['execute_modification ' ],
585+ 'action ' => Utils::htmlspecialchars (strtr ($ mod_action ['filename ' ], [Config::$ boarddir => '. ' ])),
586+ 'description ' => $ failed ? Lang::$ txt ['package_action_failure ' ] : Lang::$ txt ['package_action_success ' ],
587+ 'failed ' => $ failed ,
588+ ];
589+ }
590+
559591 if (empty ($ mod_action ['is_custom ' ])) {
560592 Utils::$ context ['actions ' ][$ actual_filename ]['operations ' ][] = [
561593 'type ' => Lang::getTxt ('execute_modification ' , file: 'Packages ' ),
@@ -565,6 +597,7 @@ public function installTest(): void
565597 'operation_key ' => $ operation_key ,
566598 'filename ' => $ action ['filename ' ],
567599 'is_boardmod ' => $ action ['boardmod ' ],
600+ 'is_diff ' => $ action ['diff ' ],
568601 'failed ' => $ mod_action ['failed ' ],
569602 'ignore_failure ' => !empty ($ mod_action ['ignore_failure ' ]),
570603 ];
@@ -580,6 +613,7 @@ public function installTest(): void
580613 'operation_key ' => $ operation_key ,
581614 'filename ' => $ action ['filename ' ],
582615 'is_boardmod ' => $ action ['boardmod ' ],
616+ 'is_diff ' => $ action ['diff ' ],
583617 'failed ' => $ mod_action ['failed ' ],
584618 'ignore_failure ' => !empty ($ mod_action ['ignore_failure ' ]),
585619 ];
@@ -1081,7 +1115,9 @@ public function install(): void
10811115 $ failed_count ++;
10821116
10831117 if ($ action ['type ' ] == 'modification ' && !empty ($ action ['filename ' ])) {
1084- if ($ action ['boardmod ' ]) {
1118+ if ($ action ['diff ' ]) {
1119+ $ mod_actions = PackageUtils::parseDiff (file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), false , $ action ['reverse ' ], $ theme_paths );
1120+ } elseif ($ action ['boardmod ' ]) {
10851121 $ mod_actions = PackageUtils::parseBoardMod (file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), false , $ action ['reverse ' ], $ theme_paths );
10861122 } else {
10871123 $ mod_actions = PackageUtils::parseModification (file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ action ['filename ' ]), false , $ action ['reverse ' ], $ theme_paths );
@@ -1850,8 +1886,9 @@ public function showOperations(): void
18501886 }
18511887 }
18521888
1853- // Boardmod?
1854- if (isset ($ _REQUEST ['boardmod ' ])) {
1889+ if (isset ($ _REQUEST ['diff ' ])) {
1890+ $ mod_actions = PackageUtils::parseDiff (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ _REQUEST ['filename ' ]), true , $ reverse , $ theme_paths );
1891+ } elseif (isset ($ _REQUEST ['boardmod ' ])) {
18551892 $ mod_actions = PackageUtils::parseBoardMod (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ _REQUEST ['filename ' ]), true , $ reverse , $ theme_paths );
18561893 } else {
18571894 $ mod_actions = PackageUtils::parseModification (@file_get_contents (Config::$ packagesdir . '/temp/ ' . Utils::$ context ['base_path ' ] . $ _REQUEST ['filename ' ]), true , $ reverse , $ theme_paths );
@@ -2635,7 +2672,7 @@ public function serverBrowse(): void
26352672 }
26362673
26372674 // Might take some time.
2638- @ set_time_limit ( 600 );
2675+ Sapi:: setTimeLimit ( );
26392676
26402677 // Read packages.xml and parse into XmlArray. (the true tells it to trim things ;).)
26412678 $ listing = new XmlArray (WebFetchApi::fetch ($ _GET ['package ' ]), true );
0 commit comments