There is several hotfixes which might help if you encounter problems trying to use Opencart 2 Extension Installer feature. The "Multiline fix" adds feature that widely used in our XML modifications, so you should made changes described in "Multiline fix" section if you plan to use our extensions.
OCMOD Multiline fix
We extended OCMOD regex
mode by adding "quote" (bool) parameter to regex
search/replace mode. This hack enables searching replacement place in sources using multiple lines of source code. The hack is simple, only 2 places with minimum changes. When this switch set to true, the preg_quote
function used:
preg_quote()
takes str and puts a backslash in front of every character that is part of the regular expression syntax. This is useful if you have a run-time string that you need to match in some text and the string may contain special regex characters.The special regular expression characters are:
. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -
This makes possible to use preg
for multiline replaces. It leaves standard mode as is, and just adds another mode (multiline).
To apply the hack to Opencart 2.0.1.1, open the file
admin/controller/extension/modification.php
and go to the line #307. You will see
} else {
$search = $operation->getElementsByTagName('search')->item(0)->textContent;
$limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
$replace = $operation->getElementsByTagName('add')->item(0)->textContent;
where you must add one line (after "$limit = ..."):
} else {
$search = $operation->getElementsByTagName('search')->item(0)->textContent;
$limit = $operation->getElementsByTagName('search')->item(0)->getAttribute('limit');
$quote = $operation->getElementsByTagName('search')->item(0)->getAttribute('quote');
$replace = $operation->getElementsByTagName('add')->item(0)->textContent;
And after
// Limit
if (!$limit) {
$limit = -1;
}
Add:
// Quote
if ($quote == 'true') {
$search = preg_quote($search);
}
Thats all.
Change length of Modifications XML database field
Opencart stores XML text of modifications in the database. The length of the field is limited: we had problem on module which changes lots of template files. So we propose to apply install.sql
, this will fix issue and enable work of big modifications.
ALTER TABLE `oc_modification` CHANGE COLUMN `xml` `xml` MEDIUMTEXT NOT NULL;
OC2 extension installer bugfix
If you receive "JSON Error" messages trying to use Extension Installer -- try this hotfix. Do not apply it if your extension installer works correctly after specifying FTP account credentials in store settings.
- fix "PHP Warning: Invalid argument supplied for foreach() ... on line 333";
- prevent "PHP Warning: ftp_mkdir(): Create directory operation failed ... on line 338" (when existing directories created: catalog, admin, admin/controller, etc.);
- prevent "PHP Warning: ftp_put(): Illegal PORT command ... on line 345"
Compatibility | |
Opencart 1.5.x | No |
Opencart 2.0 | Opencart 2.0.1.1, 2.0.2.0, 2.0.3.1 |
Overwrite files | Provided DIFF and/or set of changed files |
Opencart 2.0.1.1 bugfix: OC2 Extension installer
- Brand: OpencartJazz
- Product Code: oc2011-bugfix-extension-installer
- Availability: No files
-
Free