Added a switch to control the message display of the expand feature when cronjob runs

This commit is contained in:
Llewellyn van der Merwe 2018-04-26 02:09:15 +02:00
parent 47d1a6c155
commit 74f2d8df56
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
7 changed files with 73 additions and 30 deletions

View File

@ -126,12 +126,12 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 24th April, 2018
+ *Last Build*: 26th April, 2018
+ *Version*: 2.7.6
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **193223**
+ *Field count*: **1026**
+ *Line count*: **193266**
+ *Field count*: **1027**
+ *File count*: **1201**
+ *Folder count*: **193**

View File

@ -126,12 +126,12 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 24th April, 2018
+ *Last Build*: 26th April, 2018
+ *Version*: 2.7.6
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **193223**
+ *Field count*: **1026**
+ *Line count*: **193266**
+ *Field count*: **1027**
+ *File count*: **1201**
+ *Folder count*: **193**

View File

@ -665,6 +665,21 @@
/>
</form>
</field>
<!-- Return_options_build Field. Type: Radio. (joomla) -->
<field
type="radio"
name="return_options_build"
label="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_LABEL"
description="COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_DESCRIPTION"
class="btn-group btn-group-yesno"
default="2"
showon="development_method:2">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CONFIG_DISPLAY_MESSAGE</option>
<option value="2">
COM_COMPONENTBUILDER_CONFIG_ONLY_BOOLEAN</option>
</field>
<!-- Expansioncronjob_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="expansioncronjob_note" label="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_LABEL" description="COM_COMPONENTBUILDER_CONFIG_EXPANSIONCRONJOB_NOTE_DESCRIPTION" heading="h4" class="expansioncronjob_note" showon="development_method:2" />
</fieldset>

View File

@ -2324,6 +2324,7 @@ COM_COMPONENTBUILDER_CONFIG_DEFAULT="Default"
COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD="Development Method"
COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_DESCRIPTION="Select what development method you would like to use."
COM_COMPONENTBUILDER_CONFIG_DEVELOPMENT_METHOD_LABEL="Development Method"
COM_COMPONENTBUILDER_CONFIG_DISPLAY_MESSAGE="Display Message"
COM_COMPONENTBUILDER_CONFIG_DKIM="DKIM"
COM_COMPONENTBUILDER_CONFIG_DKIM_DESCRIPTION="Set this option to Yes if you want to sign your emails using DKIM."
COM_COMPONENTBUILDER_CONFIG_DKIM_DOMAIN_DESCRIPTION="Set the domain. Eg. domain.com"
@ -2497,6 +2498,7 @@ COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_DESCRIPTION="<p>Here you can se
COM_COMPONENTBUILDER_CONFIG_NOTE_LANGUAGE_GLOBAL_LABEL="Global Language Source"
COM_COMPONENTBUILDER_CONFIG_OFF="Off"
COM_COMPONENTBUILDER_CONFIG_ON="On"
COM_COMPONENTBUILDER_CONFIG_ONLY_BOOLEAN="Only Boolean"
COM_COMPONENTBUILDER_CONFIG_ONLY_EXTRA="Only Extra"
COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_DESCRIPTION="<code>[YEAR]</code> <code>[MONTH]</code> <code>[DAY]</code> <code>[HOUR]</code> <code>[MINUTE]</code>"
COM_COMPONENTBUILDER_CONFIG_PACKAGE_NAME_PLAEHOLDERS_LABEL="Package Name Placeholders"
@ -2511,6 +2513,8 @@ COM_COMPONENTBUILDER_CONFIG_REPLYNAME_HINT="Reply Name Here"
COM_COMPONENTBUILDER_CONFIG_REPLYNAME_LABEL="Reply to Name"
COM_COMPONENTBUILDER_CONFIG_REPOSITORY_DESCRIPTION="Should the component be moved to your local repository folder?"
COM_COMPONENTBUILDER_CONFIG_REPOSITORY_LABEL="Add to Repository Folder"
COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_DESCRIPTION="Should the system return the build info/messages, or simply 1 for success and 0 for failure."
COM_COMPONENTBUILDER_CONFIG_RETURN_OPTIONS_BUILD_LABEL="Return Options for Build"
COM_COMPONENTBUILDER_CONFIG_SENDMAIL="Sendmail"
COM_COMPONENTBUILDER_CONFIG_SENDMAIL_DESCRIPTION="Enter the path to the sendmail program directory on your host server."
COM_COMPONENTBUILDER_CONFIG_SENDMAIL_HINT="/usr/sbin/sendmail"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>24th April, 2018</creationDate>
<creationDate>26th April, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>

View File

@ -3692,7 +3692,7 @@ class com_componentbuilderInstallerScript
$query = $db->getQuery(true);
// Field to update.
$fields = array(
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","language":"en-GB","percentagelanguageadd":"50","compiler_field_builder_type":"2","set_browser_storage":"1","storage_time_to_live":"global","development_method":"1","expansion":"0","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'),
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","language":"en-GB","percentagelanguageadd":"50","compiler_field_builder_type":"2","set_browser_storage":"1","storage_time_to_live":"global","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'),
);
// Condition.
$conditions = array(

View File

@ -219,6 +219,8 @@ class ComponentbuilderControllerApi extends JControllerForm
}
// check if expansion is enabled
$method = $this->params->get('development_method', 1);
// check what kind of return values show we give
$returnOptionsBuild = $this->params->get('return_options_build', 2);
if (2 == $method)
{
// get expansion components
@ -228,8 +230,25 @@ class ComponentbuilderControllerApi extends JControllerForm
{
// check if user has the right
$user = $this->getApiUser();
// the message package
$message = array();
if ($user->authorise('core.admin', 'com_componentbuilder'))
{
// make sure to not unlock
$unlock = false;
// get messages
$callback = function($messages) use (&$message, &$unlock) {
// unlock messages if needed
if ($unlock) {
$messages = ComponentbuilderHelper::unlock($messages);
}
// check if we have any messages
if (ComponentbuilderHelper::checkArray($messages)) {
$message[] = implode("<br />\n", $messages);
} else {
// var_dump($messages); // error debug message
}
};
// we have two options, doing them one at a time, use using curl to do tome somewhat asynchronously
if (count ( (array) $expansion) > 1 && function_exists('curl_version'))
{
@ -238,17 +257,8 @@ class ComponentbuilderControllerApi extends JControllerForm
{
ComponentbuilderHelper::setWorker($component, 'compileInstall');
}
// get messages function
$callback = function($messages) {
$messages = ComponentbuilderHelper::unlock($messages);
// check if we have any messages
if (ComponentbuilderHelper::checkArray($messages))
{
// echo "<br />\n".implode("<br />\n", $messages); // (TODO) adding a switch to show messages
} else {
var_dump($messages); // error debug message
}
};
// make sure to unlock
$unlock = true;
// run workers
ComponentbuilderHelper::runWorker('compileInstall', 1, $callback);
}
@ -265,27 +275,41 @@ class ComponentbuilderControllerApi extends JControllerForm
$model->compileInstall($component);
}
// check if we have any messages
if (ComponentbuilderHelper::checkArray($model->messages))
{
// echo the messages
// echo "<br />\n".implode("<br />\n", $model->messages); // (TODO) adding a switch to show messages
} else {
var_dump($messages); // error debug message
$callback($model->messages);
}
// return messages if found
if (1== $returnOptionsBuild && ComponentbuilderHelper::checkArray($message))
{
echo implode("<br />\n", $message);
}
else
{
echo 1;
}
// clear session
JFactory::getApplication()->getSession()->destroy();
jexit();
}
// check if message is to be returned
if (1== $returnOptionsBuild)
{
// clear session
JFactory::getApplication()->getSession()->destroy();
jexit('Access Denied!');
}
}
}
// clear session
JFactory::getApplication()->getSession()->destroy();
// check if message is to be returned
if (1== $returnOptionsBuild)
{
jexit('Expansion Disabled!');
}
// return bool
echo 0;
jexit();
}
protected function getApiUser()
{