Revision history for InstallableActions


Revision [23177]

Last edited on 2016-05-20 07:38:47 by NilsLindenberg [Replaces old-style internal links with new pipe-split links.]
Additions:
[[InstallableActionTemplate | Template for the actions]]
Deletions:
[[InstallableActionTemplate Template for the actions]]


Revision [19097]

Edited on 2008-01-28 00:14:02 by NilsLindenberg [Modified links pointing to docs server]

No Differences

Revision [16561]

Edited on 2007-05-17 05:21:51 by NilsLindenberg [note on files]
Additions:
Let's start with the show handler... (**handler/page/show.php**)
Now it's time to replace the Action() method in **root/wikka.php**:
We'll do the same for the Run() method in the same file (**root/wikka.php**):
Now we need to open up **wikka.config.php** and add the following lines to the bottom of the file:
Speaking of writing a new config file, maybe we should go ahead and do that. Save the following code as **uploads/action.config.php**:
Save the following in the wikka root directory as "**util.php**"...
Save the following in the actions directory as **installer.php**:
Deletions:
Let's start with the show handler...
Now it's time to replace the Action() method in wikka.php:
We'll do the same for the Run() method in the same file:
Now we need to open up wikka.config.php and add the following lines to the bottom of the file:
Speaking of writing a new config file, maybe we should go ahead and do that. Save the following code as uploads/action.config.php:
Save the following in the wikka root directory as "util.php"...
Save the following in the actions directory as installer.php:


Revision [10601]

Edited on 2005-08-10 13:49:22 by DennyShimkoski [Removed bit about restricting read/write access]
Additions:
Now create a page like "ActionInstaller" and call the action from within it like so -- ""{{installer}}"".
Deletions:
Now create a page like "ActionInstaller," restrict read/write access to an admin user, and call the action from within it like so -- ""{{installer}}"".


Revision [10600]

Edited on 2005-08-10 13:44:51 by DennyShimkoski [Added question about handlers]
Additions:
As you can see, the entire file has changed. Instead of directly printing everything to output, we're collecting it in a variable called $page. Also, we've moved the calls to Header() and Footer() out of the Run() method in wikka.php and put them at the bottom of this file. This will allow for actions to send headers to the browser directly, rather than requiring developers to define a separate "handler" file for such cases (**please discuss: was this ever actually a requirement?**). With this setup, actions will now be processed before anything is sent back to the browser.
Deletions:
As you can see, the entire file has changed. Instead of directly printing everything to output, we're collecting it in a variable called $page. Also, we've moved the calls to Header() and Footer() out of the Run() method in wikka.php and put them at the bottom of this file. This will allow for actions to send headers to the browser directly, rather than requiring developers to define a separate "handler" file for such cases. With this setup, actions will now be processed before anything is sent back to the browser.


Revision [10599]

Edited on 2005-08-10 13:40:41 by DennyShimkoski [Added question about handlers]
Additions:
if ($this->IsAdmin())
}} // end IsAdmin() check


Revision [10596]

Edited on 2005-08-10 11:30:36 by NilsLindenberg [added see also box]
Additions:
>>**See also**
[[InstallableActionTemplate Template for the actions]]
>>


Revision [10586]

Edited on 2005-08-10 06:12:54 by DennyShimkoski [added see also box]
Additions:
Here we look through the current page for any calls to actions that are installed on the system (through the InstallableActions interface). If we find any that included a CSS file as part of their installation package, we add the corresponding CSS file to an array.
Deletions:
Here we look through the current page for any actions that are installed on the system (through the InstallableActions interface). If we find any that included a CSS file as part of their installation package, we add the corresponding CSS file to an array.


Revision [10583]

Edited on 2005-08-10 06:08:20 by DennyShimkoski [added see also box]
Additions:
====Authors====
CategoryUserContributions


Revision [10582]

Edited on 2005-08-10 06:07:43 by DennyShimkoski [Hacked code formatting problems]
Additions:
A special case for the show handler has been added -- the elseif ""($this->method == 'show')"" part. That's the only change.
return preg_match("/%REMOVE ME%\($language\)(.*)%REMOVE ME%/ismU", $wikka_body, $matches) ? $matches[1] : false;
**Note:** You'll have to find %REMOVE ME% and replace with ""%%"" in your text editor before the above code will work.
if (strstr($row['body'], '%REMOVE ME%(php)') && $current_version)
$mysql = strstr($row['body'], '%REMOVE ME%(mysql)') ? 'Yes' : 'No';
$css = strstr($row['body'], '%REMOVE ME%(css)') ? 'Yes' : 'No';
echo $this->Format("If you click continue, the following queries will be run...\n\n%REMOVE ME%" . join('', $queries) . '%REMOVE ME%');
echo $this->Format("%REMOVE ME%\n$report\n%REMOVE ME%");
echo $this->Format("If you continue, the Installer will write the following CSS code to \"$css_filename\"\n\n%REMOVE ME%$css%REMOVE ME%");
$config_msg = "===Config Settings===\n\n%REMOVE ME%$config_msg%REMOVE ME%\n";
echo $this->Format("$config_msg===Action Code===\n\n%REMOVE ME%$file_warning\n$code%REMOVE ME%\nContinue install?");
$mysql = isset($queries) ? "\nThe following queries will be run:\n\n%REMOVE ME%" . join('', $queries) . '%REMOVE ME%' : '';
$settings = "\nThe following config settings will be removed:\n\n%REMOVE ME%" . join("\n", $settings) . "%REMOVE ME%";
echo $this->Format("====Warning====\n$mysql$settings\nThe following files will be removed:\n\n%REMOVE ME%$php_file$css_file%REMOVE ME%");
$mysql = "\nRunning queries:\n\n%REMOVE ME%$mysql%REMOVE ME%";
$files = ($php_file || $css_file) ? "Removing files:\n\n%REMOVE ME%$php_file$css_file%REMOVE ME%" : '';
**Note:** You'll have to find %REMOVE ME% and replace with ""%%"" in your text editor before the above code will work.
Deletions:
A special case for the show handler has been added -- the elseif ($this->method == 'show') part. That's the only change.
return preg_match("/%%\($language\)(.*)%%/ismU", $wikka_body, $matches) ? $matches[1] : false;
if (strstr($row['body'], '%%(php)') && $current_version)
$mysql = strstr($row['body'], '%%(mysql)') ? 'Yes' : 'No';
$css = strstr($row['body'], '%%(css)') ? 'Yes' : 'No';
echo $this->Format("If you click continue, the following queries will be run...\n\n%%" . join('', $queries) . '%%');
echo $this->Format("%%\n$report\n%%");
echo $this->Format("If you continue, the Installer will write the following CSS code to \"$css_filename\"\n\n%%$css%%");
$config_msg = "===Config Settings===\n\n%%$config_msg%%\n";
echo $this->Format("$config_msg===Action Code===\n\n%%$file_warning\n$code%%\nContinue install?");
$mysql = isset($queries) ? "\nThe following queries will be run:\n\n%%" . join('', $queries) . '%%' : '';
$settings = "\nThe following config settings will be removed:\n\n%%" . join("\n", $settings) . "%%";
echo $this->Format("====Warning====\n$mysql$settings\nThe following files will be removed:\n\n%%$php_file$css_file%%");
$mysql = "\nRunning queries:\n\n%%$mysql%%";
$files = ($php_file || $css_file) ? "Removing files:\n\n%%$php_file$css_file%%" : '';


Revision [10581]

The oldest known version of this page was created on 2005-08-10 05:56:36 by DennyShimkoski [Hacked code formatting problems]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki