forked from joomla/Component-Builder
Added more compiler messages to give info on how the assets table fix works if needed.
This commit is contained in:
parent
b3ab6337d2
commit
838aa1208b
@ -133,7 +133,6 @@ Get involved on the forums, and the GitHub issues, and you can even help us deve
|
||||
TODO
|
||||
======
|
||||
|
||||
- Add automatic (REST) API ability for all components build with [JCB](http://joomlacomponentbuilder.com). So we can link any component build with JCB to an Android/Apple APP.
|
||||
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](http://joomlacomponentbuilder.com).
|
||||
- Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online.
|
||||
- Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this)
|
||||
@ -144,11 +143,11 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 11th December, 2020
|
||||
+ *Last Build*: 12th December, 2020
|
||||
+ *Version*: 2.12.2
|
||||
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **290481**
|
||||
+ *Line count*: **290479**
|
||||
+ *Field count*: **1555**
|
||||
+ *File count*: **1923**
|
||||
+ *Folder count*: **316**
|
||||
|
@ -133,7 +133,6 @@ Get involved on the forums, and the GitHub issues, and you can even help us deve
|
||||
TODO
|
||||
======
|
||||
|
||||
- Add automatic (REST) API ability for all components build with [JCB](http://joomlacomponentbuilder.com). So we can link any component build with JCB to an Android/Apple APP.
|
||||
- Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](http://joomlacomponentbuilder.com).
|
||||
- Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online.
|
||||
- Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this)
|
||||
@ -144,11 +143,11 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 11th December, 2020
|
||||
+ *Last Build*: 12th December, 2020
|
||||
+ *Version*: 2.12.2
|
||||
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **290481**
|
||||
+ *Line count*: **290479**
|
||||
+ *Field count*: **1555**
|
||||
+ *File count*: **1923**
|
||||
+ *Folder count*: **316**
|
||||
|
@ -190,13 +190,69 @@ class Compiler extends Infusion
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf(
|
||||
'The <b>%s</b> language has %s% translated. Was addeded %s',
|
||||
'The <b>%s</b> language has %s% translated. Was added %s',
|
||||
$tag, $percentage, $whyAddedLang
|
||||
), 'Notice'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// set assets table column fix type messages
|
||||
$message_fix['intelligent'] = JText::_(
|
||||
'The <b>intelligent</b> fix only updates the #__assets table\'s column when it detects that it is too small for the worse case. The intelligent fix also only reverse the #__assets table\'s update on uninstall of the component if it detects that no other component needs the rules column to be larger any longer. This options also shows a notice to the end user of all that it does to the #__assets table on installation and uninstalling of the component.'
|
||||
);
|
||||
$message_fix['sql'] = JText::_(
|
||||
'The <b>SQL</b> fix updates the #__assets table\'s column size on installation of the component and reverses it back to the Joomla default on uninstall of the component.'
|
||||
);
|
||||
// set assets table rules column notice
|
||||
if ($this->addAssetsTableFix)
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
JText::_('<hr /><h3>Assets Table Notice</h3>'), 'Notice'
|
||||
);
|
||||
$asset_table_fix_type = ($this->addAssetsTableFix == 2)
|
||||
? 'intelligent' : 'sql';
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf(
|
||||
'The #__assets table <b>%s</b> fix has been added to this component. %s',
|
||||
$asset_table_fix_type,
|
||||
$message_fix[$asset_table_fix_type]
|
||||
), 'Notice'
|
||||
);
|
||||
}
|
||||
// set assets table rules column Warning
|
||||
elseif ($this->accessSize >= 30)
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
JText::_('<hr /><h3>Assets Table Warning</h3>'), 'Warning'
|
||||
);
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf(
|
||||
'The Joomla #__assets table\'s rules column has to be fixed for this component to work coherently. JCB has detected that in worse case the rules column in the #__assets table may require <b>%s</b> characters, and yet the Joomla default is only <b>varchar(5120)</b>. JCB has three option to resolve this issue, first <b>use less permissions</b> in your component, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s',
|
||||
$this->accessWorseCase, $message_fix['intelligent'],
|
||||
$message_fix['sql']
|
||||
), 'Warning'
|
||||
);
|
||||
}
|
||||
// set assets table name column warning if not set
|
||||
if (!$this->addAssetsTableFix && $this->addAssetsTableNameFix)
|
||||
{
|
||||
// only add if not already added
|
||||
if ($this->accessSize < 30)
|
||||
{
|
||||
$this->app->enqueueMessage(
|
||||
JText::_('<hr /><h3>Assets Table Warning</h3>'),
|
||||
'Warning'
|
||||
);
|
||||
}
|
||||
$this->app->enqueueMessage(
|
||||
JText::sprintf(
|
||||
'The Joomla #__assets table\'s name column has to be fixed for this component to work correctly. JCB has detected that the #__assets table name column will need to be enlarged because this component\'s own naming convention is larger than varchar(50) which is the Joomla default. JCB has three option to resolve this issue, first <b>shorter names</b> for your component and/or its admin views, second use the <b>SQL</b> fix, or the <b>intelligent</b> fix. %s %s',
|
||||
$message_fix['intelligent'],
|
||||
$message_fix['sql']
|
||||
), 'Warning'
|
||||
);
|
||||
}
|
||||
// move the update server into place
|
||||
$this->setUpdateServer();
|
||||
// set the global counters
|
||||
|
@ -102,6 +102,13 @@ class Get
|
||||
*/
|
||||
public $addAssetsTableFix = 1;
|
||||
|
||||
/**
|
||||
* Assets table worse case
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $accessWorseCase;
|
||||
|
||||
/**
|
||||
* Switch to add assets table name fix
|
||||
*
|
||||
|
@ -8523,18 +8523,10 @@ class Interpretation extends Fields
|
||||
// check if we should add the intelligent fix treatment for the assets table
|
||||
if ($this->addAssetsTableFix == 2)
|
||||
{
|
||||
// get the worse case column size required (can be worse I know)
|
||||
// access/action size x 20 characters x 8 groups
|
||||
$character_length = (int) ComponentbuilderHelper::bcmath(
|
||||
'mul', $this->accessSize, 20, 0
|
||||
);
|
||||
$character_length = (int) ComponentbuilderHelper::bcmath(
|
||||
'mul', $character_length, 8, 0
|
||||
);
|
||||
// get the type we will convert to
|
||||
$data_type = ($character_length > 64000) ? "MEDIUMTEXT" : "TEXT";
|
||||
$data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT" : "TEXT";
|
||||
// the if statement about $rule_length
|
||||
$codeIF = "\$rule_length <= " . $character_length;
|
||||
$codeIF = "\$rule_length <= " . $this->accessWorseCase;
|
||||
// fix column size
|
||||
$script = array();
|
||||
$script[] = $this->_t(5) . "//" . $this->setLine(__LINE__)
|
||||
@ -10658,7 +10650,7 @@ class Interpretation extends Fields
|
||||
. ' Always insure this column rules is large enough for all the access control values.';
|
||||
$db .= PHP_EOL . '--';
|
||||
$db .= PHP_EOL
|
||||
. "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';";
|
||||
. "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';";
|
||||
}
|
||||
// smaller then 400 makes TEXT large enough
|
||||
elseif ($this->addAssetsTableFix == 1)
|
||||
@ -10672,7 +10664,7 @@ class Interpretation extends Fields
|
||||
. ' Always insure this column rules is large enough for all the access control values.';
|
||||
$db .= PHP_EOL . '--';
|
||||
$db .= PHP_EOL
|
||||
. "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control.';";
|
||||
. "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';";
|
||||
}
|
||||
}
|
||||
|
||||
@ -27191,6 +27183,17 @@ function vdm_dkim() {
|
||||
// we do not need the fix for this component
|
||||
$this->addAssetsTableFix = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the worse case column size required (can be worse I know)
|
||||
// access/action size x 20 characters x 8 groups
|
||||
$character_length = (int) ComponentbuilderHelper::bcmath(
|
||||
'mul', $this->accessSize, 20, 0
|
||||
);
|
||||
$this->accessWorseCase = (int) ComponentbuilderHelper::bcmath(
|
||||
'mul', $character_length, 8, 0
|
||||
);
|
||||
}
|
||||
|
||||
// return the build
|
||||
return $component;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>11th December, 2020</creationDate>
|
||||
<creationDate>12th December, 2020</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user