Skip to content

Commit

Permalink
Namespace all core actions and change include to includeOnce
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Feb 10, 2024
1 parent 1b4bb36 commit 347a770
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 35 deletions.
3 changes: 2 additions & 1 deletion ProcessAdminActions.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,15 @@ private function getActionPath($actionName) {
private function includeAndInstantiate($actionName) {
$actionPath = $this->getActionPath($actionName);
$ns = $this->wire('files')->getNamespace($actionPath);
// if the action is in the root namespace, then we need to compile it
if($ns === '\\') {
$actionPath = $this->wire('files')->compile($actionPath);
$nsClass = '\\' . $actionName;
}
else {
$nsClass = $ns . '\\' . $actionName;
}
$this->wire('files')->include($actionPath);
$this->wire('files')->includeOnce($actionPath);
$this->action = new $nsClass();
}

Expand Down
2 changes: 1 addition & 1 deletion actions/ConvertFieldsToMultiLanguage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class ConvertFieldsToMultiLanguage extends ProcessAdminActions {

Expand Down
2 changes: 1 addition & 1 deletion actions/CopyContentToOtherField.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CopyContentToOtherField extends ProcessAdminActions {

Expand Down
4 changes: 2 additions & 2 deletions actions/CopyFieldContentToOtherPage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CopyFieldContentToOtherPage extends ProcessAdminActions {

Expand Down Expand Up @@ -59,4 +59,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/CopyPageTableItemsToOtherPage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CopyPageTableItemsToOtherPage extends ProcessAdminActions {

Expand Down Expand Up @@ -160,4 +160,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/CopyRepeaterItemsToOtherPage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CopyRepeaterItemsToOtherPage extends ProcessAdminActions {

Expand Down Expand Up @@ -144,4 +144,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/CopyTableFieldRowsToOtherPage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CopyTableFieldRowsToOtherPage extends ProcessAdminActions {

Expand Down Expand Up @@ -136,4 +136,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/CreateUsersBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class CreateUsersBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -156,4 +156,4 @@ private function isJSON($string){
return (json_last_error()===JSON_ERROR_NONE);
}

}
}
4 changes: 2 additions & 2 deletions actions/DeleteUnusedFields.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class DeleteUnusedFields extends ProcessAdminActions {

Expand Down Expand Up @@ -50,4 +50,4 @@ protected function executeAction($options) {

}

}
}
2 changes: 1 addition & 1 deletion actions/DeleteUnusedTemplates.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class DeleteUnusedTemplates extends ProcessAdminActions {

Expand Down
4 changes: 2 additions & 2 deletions actions/EmailBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class EmailBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -226,4 +226,4 @@ private function replaceWhitespace($str) {
return $str !== $result ? $this->replaceWhitespace($result) : $result;
}

}
}
5 changes: 2 additions & 3 deletions actions/FieldSetOrSearchAndReplace.action.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
// this action is not ready for use yet, which is why the filename doesn't have ".action" in it, so it won't be installed
<?php namespace ProcessWire;

class FieldSetOrSearchAndReplace extends ProcessAdminActions {

Expand Down Expand Up @@ -185,4 +184,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/FtpFilesToPage.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class FtpFilesToPage extends ProcessAdminActions {

Expand Down Expand Up @@ -88,4 +88,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/PageActiveLanguagesBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class PageActiveLanguagesBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -83,4 +83,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/PageManipulator.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class PageManipulator extends ProcessAdminActions {

Expand Down Expand Up @@ -121,4 +121,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/PageTableToRepeaterMatrix.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class PageTableToRepeaterMatrix extends ProcessAdminActions {

Expand Down Expand Up @@ -364,4 +364,4 @@ private function getUniqueRepeaterPageName() {
return str_replace('.', '-', microtime(true)) . '-' . (++$cnt);
}

}
}
4 changes: 2 additions & 2 deletions actions/TemplateFieldsBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class TemplateFieldsBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -79,4 +79,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/TemplateRolesBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class TemplateRolesBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -130,4 +130,4 @@ protected function executeAction($options) {

}

}
}
4 changes: 2 additions & 2 deletions actions/UserRolesPermissionsBatcher.action.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php namespace ProcessWire;

class UserRolesPermissionsBatcher extends ProcessAdminActions {

Expand Down Expand Up @@ -109,4 +109,4 @@ protected function executeAction($options) {

}

}
}

0 comments on commit 347a770

Please sign in to comment.