-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup, operationally, Capone plugin.
There were a few files where the capone items were directly coded in the core of fog. This left potential issues. Move these rather implicit calls to a hook within the capone plugin itself. The only left over capone items are for init option generation and the capone.php file within the service directory.
- Loading branch information
1 parent
7bfc7f2
commit c90f023
Showing
12 changed files
with
233 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
packages/web/lib/plugins/capone/hooks/addbootmenuitem.hook.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
/** | ||
* Creates the capone menu item. | ||
* | ||
* PHP Version 5 | ||
* | ||
* @category AddBootMenuItem | ||
* @package FOGProject | ||
* @author Tom Elliott <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 | ||
* @link https://fogproject.org | ||
*/ | ||
/** | ||
* Creates the capone menu item. | ||
* | ||
* @category AddBootMenuItem | ||
* @package FOGProject | ||
* @author Tom Elliott <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 | ||
* @link https://fogproject.org | ||
*/ | ||
class AddBootMenuItem extends Hook | ||
{ | ||
/** | ||
* The name of this hook. | ||
* | ||
* @var string | ||
*/ | ||
public $name = 'AddBootMenuItem'; | ||
/** | ||
* The description of this hook. | ||
* | ||
* @var string | ||
*/ | ||
public $description = 'Add capone menu item'; | ||
/** | ||
* The active flag. | ||
* | ||
* @var bool | ||
*/ | ||
public $active = true; | ||
/** | ||
* The node this hook enacts with. | ||
* | ||
* @var string | ||
*/ | ||
public $node = 'capone'; | ||
/** | ||
* Creates the storage node. | ||
* | ||
* @return void | ||
*/ | ||
public function addBootMenuItem() | ||
{ | ||
if (!in_array($this->node, (array)$_SESSION['PluginsInstalled'])) { | ||
return; | ||
} | ||
$dmi = self::getSetting('FOG_PLUGIN_CAPONE_DMI'); | ||
$shutdown = self::getSetting('FOG_PLUGIN_CAPONE_SHUTDOWN'); | ||
if (!$dmi) { | ||
return; | ||
} | ||
$exists = self::getClass('PXEMenuOptionsManager') | ||
->exists('fog.capone', '', 'name'); | ||
$args = trim("mode=capone shutdown=$shutdown"); | ||
$entry = self::getClass('PXEMenuOptions') | ||
->set('name', 'fog.capone') | ||
->load('name'); | ||
if (!$exists) { | ||
$entry | ||
->set('name', 'fog.capone') | ||
->set('description', _('Capone Deploy')) | ||
->set('args', $args) | ||
->set('params', null) | ||
->set('default', 0) | ||
->set('regMenu', 2); | ||
} | ||
$setArgs = explode(' ', trim($entry->get('args'))); | ||
$neededArgs = explode(' ', trim($args)); | ||
$sureArgs = array(); | ||
foreach ((array)$setArgs as &$arg) { | ||
if (!preg_match('#^dmi=#', $arg)) { | ||
$sureArgs[] = $arg; | ||
} | ||
unset($arg); | ||
} | ||
$setArgs = $sureArgs; | ||
foreach ((array)$neededArgs as &$arg) { | ||
if (!in_array($arg, $setArgs)) { | ||
$setArgs[] = $arg; | ||
} | ||
unset($arg); | ||
} | ||
$setArgs[] = sprintf('dmi=%s', $dmi); | ||
$entry | ||
->set('args', implode(' ', $setArgs)) | ||
->save(); | ||
} | ||
} | ||
$HookManager | ||
->register( | ||
'BOOT_MENU_ITEM', | ||
array( | ||
new AddBootMenuItem(), | ||
'addBootMenuItem' | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: fog-project-2\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-12-23 19:33-0500\n" | ||
"POT-Creation-Date: 2016-12-29 20:31-0500\n" | ||
"PO-Revision-Date: 2016-05-23 07:36-0400\n" | ||
"Last-Translator: vspushbullet <[email protected]>\n" | ||
"Language-Team: German\n" | ||
|
@@ -939,11 +939,7 @@ msgstr "Registriert" | |
msgid "Set Failed" | ||
msgstr "Fehler beim" | ||
|
||
#: /var/www/fog/lib/fog/bootmenu.class.php:489 | ||
msgid "Capone Deploy" | ||
msgstr "Capone bereitstellen" | ||
|
||
#: /var/www/fog/lib/fog/bootmenu.class.php:1481 | ||
#: /var/www/fog/lib/fog/bootmenu.class.php:1356 | ||
#, fuzzy | ||
msgid "No valid storage nodes found" | ||
msgstr "Ungültige Speicherknoten" | ||
|
@@ -5966,20 +5962,25 @@ msgstr "Plugin installiert!" | |
msgid "Settings Updated" | ||
msgstr "Einstellungen aktualisiert" | ||
|
||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:604 | ||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:599 | ||
#, fuzzy | ||
msgid "Must have an image associated" | ||
msgstr "Snap-in muss zu einer Gruppe verknüpft haben" | ||
|
||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:607 | ||
msgid "Failed to save assignment" | ||
msgstr "Fehler beim Speichern der Zuordnung" | ||
|
||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:606 | ||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:609 | ||
msgid "Assignment saved successfully" | ||
msgstr "Auftrag erfolgreich gespeichert" | ||
|
||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:612 | ||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:615 | ||
#, fuzzy | ||
msgid "Destroyed assignments" | ||
msgstr "Zerstörte Zuordnung" | ||
|
||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:614 | ||
#: /var/www/fog/lib/pages/pluginmanagementpage.class.php:617 | ||
msgid "Destroyed assignment" | ||
msgstr "Zerstörte Zuordnung" | ||
|
||
|
@@ -6725,6 +6726,10 @@ msgstr "Aktuelle Sendung" | |
msgid "WOL Broadcast Management" | ||
msgstr "WOL Broadcast Management" | ||
|
||
#: /var/www/fog/lib/plugins/capone/hooks/addbootmenuitem.hook.php:72 | ||
msgid "Capone Deploy" | ||
msgstr "Capone bereitstellen" | ||
|
||
#: /var/www/fog/lib/db/pdodb.class.php:90 | ||
#: /var/www/fog/lib/db/mysql.class.php:16 | ||
msgid "Failed to connect" | ||
|
@@ -9149,9 +9154,6 @@ msgstr "Es gibt keine Orte auf diesem Server." | |
#~ "Eine Datei für das Snap-in verwenden müssen entweder hochgeladen oder aus " | ||
#~ "der bereits vorhandenen Liste ausgewählt werden" | ||
|
||
#~ msgid "Must have snapin associated to a group" | ||
#~ msgstr "Snap-in muss zu einer Gruppe verknüpft haben" | ||
|
||
#~ msgid "Snapin added, Editing now!" | ||
#~ msgstr "Snap-in hinzugefügt, jetzt bearbeiten!" | ||
|
||
|
Oops, something went wrong.