Page 1 of 1
ocmod cannot handle renamed admin folder
Posted: Wed Mar 25, 2015 7:17 pm
by TLEwebdevs
This is a bug report, I've found quick and dirty workarounds as detailed below - OC devs need to address the main issue reported ...
Main issues -
1. The install and configuration guide pages on the OpenCart site call for renaming the admin folder as a highly recommended action (I agree with that). However this breaks the modifications installer for ocmod extensions.
1a. If the ocmod extension contains a folder and file set for /admin/ in the upload folder, the main extensions installer does not redirect the upload to the renamed admin folder, instead it creates a new folder called admin and sends the upload there.
1b. The extensions installer does not recognise the renamed admin folder for actioning the install.ocmod.xml file and fails without errors leaving no addition of links and settings in admin for the uploaded extension - also no addition of the extension to Users - User Groups - for setting access and modification permissions.
There are some workarounds I have found through trial and error, but they are not a long term solution and they are certainly not recommended if OC is building towards a WordPress-style solution where modifications can be downloaded and installed direct from the OpenCart repository from within the modifications installer ...
2. Download the extension to your local hard drive and unzip it.
- rename the admin folder to your new name for admin (e.g. if your admin folder is called rottentomato then use the same name to rename the admin folder in the extension package.
- make sure the install.xml is called install.ocmod.xml (I have found too many 2.0.1.1 extensions without this)
- re-zip the package with its original name
2a. upload via the extensions installer and refresh the modifications cache
- first thing you will most probably notice is that EITHER the left menu link in admin does not display where it should be AND / OR the permissions checkboxes in Users-User Groups are missing.
- open the install.ocmod.xml file on your local hard drive ... now hard code the changes into the files and places on your server install that are indicated in the XML code.
- go back to the modifications list page in admin and refresh the modifications cache ... several times - it does not always "take" on the first attempt.
- go back to Users-Users Groups and look for the permissions checkboxes, they should be there now, tick them and save, then back to modifications to refresh the cache several times again.
- now look throughout the left hand admin menu for the settings page link - if it's not there, refresh the cache and if still not there, check again next week when it will mysteriously appear in some illogical position ... at least that's how I've experienced it.
Hope it helps someone, especially the OC Devs - take a look at how vqmod handles renaming the admin folder - ocmod needs something similar.
edited to fix typos
Re: ocmod cannot handle renamed admin folder
Posted: Thu Mar 26, 2015 3:21 am
by ocmobi
Are you sure you updated your configs properly and changed all pathing on the site and in other areas to reflect your file system changes?
Re: ocmod cannot handle renamed admin folder
Posted: Thu Mar 26, 2015 9:34 am
by fido-x
We're not mind readers. No offence, but how are we, as developers, supposed to know what you've renamed your admin folder to?
Re: ocmod cannot handle renamed admin folder
Posted: Thu Mar 26, 2015 9:06 pm
by Venkko
Hi!
We're not mind readers. No offence, but how are we, as developers, supposed to know what you've renamed your admin folder to?
It should be an admin panel field where you can write what is your admin folder called at.
This would be the easiest way (for users) to tell opencart what they call their admin folder.
TLEwebdevs: I am quite a sure that there is OpenCart file where developers have commented place where you can change what your admin folder is named. I can't remember where and what file it was but I have seen it on somewhere.
Re: ocmod cannot handle renamed admin folder
Posted: Thu Mar 26, 2015 9:20 pm
by ocmobi
Changing the admin folder shouldn't be necessary, people do it for security but there's many other ways to achieve the same goal.
You can whitelist ips for your admin section, you can add some vqmod/ocmod to use a key/pass combo on the url ie admin/index.php?key=blah otherwise redirect to the front end so it's as if it's hidden, add brute force protection to admin login, add captcha to admin login, and etc.
So if your motives are security there's other better options than potentially breaking Opencart. Many other systems don't have built in features to change admin folders while some don't care what you call admin folders. It doesn't really matter, it's not the holy grail of solutions to combat security issues...
Re: ocmod cannot handle renamed admin folder
Posted: Thu Mar 26, 2015 9:50 pm
by Qphoria
vQmod supports admin renaming

Jus' Sayin!
Re: ocmod cannot handle renamed admin folder
Posted: Fri Mar 27, 2015 12:34 pm
by fido-x
Administrator index.php not writeable
Yes, vQmod supports a renamed admin folder, as long as you install it BEFORE renaming the admin folder, otherwise you get the above message and vQmod is not installed at all (even on the front-end). You would also have to edit every vQmod .xml file and replace any reference to the old admin folder with the new folder name.
Don't get me wrong, vQmod is a GREAT add-on and, if I wore a hat, I'd take it off to Qphoria for developing it!
However, while the OP is correct when stating that OCMOD does not support a renamed admin folder, it doesn't change the fact that we, as developers, have no way of knowing what the admin folder has been renamed to. There is no way of "automagically" detecting it.
Re: ocmod cannot handle renamed admin folder
Posted: Fri Mar 27, 2015 7:57 pm
by ocmobi
Why do you need it anyway? Use dirname and ma given file constant. why do you need to rely on folder name?
Re: ocmod cannot handle renamed admin folder
Posted: Wed Apr 01, 2015 12:08 am
by Qphoria
fido-x wrote:
Yes, vQmod supports a renamed admin folder, as long as you install it BEFORE renaming the admin folder.
Yes but you just need to rename the admin folder temporarily to "admin".. then run vqmod installer and then change it back. You don't need to edit the config files or anything. It's extremely minor.
fido-x wrote:
You would also have to edit every vQmod .xml file and replace any reference to the old admin folder with the new folder name.
This is completely
untrue and we should do better to advertise proper use.
Since vQmod 2.3 (about 2 years ago), Jay added the "pathReplaces.php" file which lets you set up a translation from "admin" to "whatever" in one place, one time. So you
DO NOT need to edit ANY files. It will automatically translate the path without needing to change any xml files.
More Info
Never underestimate vQmod again!
Re: ocmod cannot handle renamed admin folder
Posted: Wed Apr 08, 2015 4:22 pm
by TLEwebdevs
fido-x wrote:We're not mind readers. No offence, but how are we, as developers, supposed to know what you've renamed your admin folder to?
Have a look at the WordPress open source code - how do they do it?
(Simplistic answer - they have you rename it during install then commit that name somewhere in the database, or possibly in the .htaccess file ... possibly in plain text, possibly encrypted, I never looked deep into it because it works).
They also have you change the database tables prefix from "wp_" to whatever you like within MySQL's restrictions during install, and that is written to the config.php file during the install.
There are easy ways and hard ways to do this, and I'd suggest there's a large proportion of OpenCart users who are not code-jockeys, therefore the solution should be as easy to use and interaction-free as possible.
Re: ocmod cannot handle renamed admin folder
Posted: Wed Apr 08, 2015 4:28 pm
by TLEwebdevs
Qphoria wrote:
This is completely
untrue and we should do better to advertise proper use.
Since vQmod 2.3 (about 2 years ago), Jay added the "pathReplaces.php" file which lets you set up a translation from "admin" to "whatever" in one place, one time. So you
DO NOT need to edit ANY files. It will automatically translate the path without needing to change any xml files.
More Info
Never underestimate vQmod again!
As someone completely new to OpenCart and vQmod, it took me almost a week of hair pulling to discover the pathReplaces.php solution - could I ask that you comment it into the mod description in the opencart repository, and into a readme.txt within the mod package? Please, pretty please? It might save future users some angst.

Re: ocmod cannot handle renamed admin folder
Posted: Wed Apr 08, 2015 4:30 pm
by TLEwebdevs
ocmobi wrote:Are you sure you updated your configs properly and changed all pathing on the site and in other areas to reflect your file system changes?
Is there a checklist anywhere for ALL the places that need updated? I couldn't find one linked from the installation pages on the site.
Re: ocmod cannot handle renamed admin folder
Posted: Sat Apr 11, 2015 10:30 am
by kombi
Not sure if this a correct place to ask... But here I go.. I am using opencart 2.0.2, I was updating a extension via OCMOD by uploading the new file package via the uploader. What happened is the old file did not get deleted/overwritten after the update like with VQMOD files being overwritten. So the dual copy is creating a conflict and I cannot get back into my admin page. I can not find the path to where the Ocmod stores the XML like in VQMOD. Where are the XML stored so I can manually delete them in OCMOD.
Re: ocmod cannot handle renamed admin folder
Posted: Sat Apr 11, 2015 11:41 am
by kombi
looks like it stored in the database under "modification" so how do you easily delete and flush the opencart cache to clean it out? VQMOD you just delete the cache folder?
Re: ocmod cannot handle renamed admin folder
Posted: Sat Apr 18, 2015 11:50 am
by fido-x
kombi wrote:looks like it stored in the database under "modification" so how do you easily delete and flush the opencart cache to clean it out? VQMOD you just delete the cache folder?
Click the orange "Clear" button to clear the modification cache. Click the blue "Refresh" button to refresh the cache.
If your modifications are preventing access to the "Extensions->Modification" page in the admin, you can use the file manager from your hosting control panel to clear the files in the "system/modification" directory. Note: DO NOT delete the "index.html" file.
Re: ocmod cannot handle renamed admin folder
Posted: Sat Oct 31, 2015 7:47 am
by alber99
Is this still a problem in OC 2.0.3 ?
I've changed the name of my admin folder and sometimes experience incomplete extension installs using OCMOD - usually the upload step says "successful" but then the mod does not appear in Admin - so can't get beyond that step.
Re: ocmod cannot handle renamed admin folder
Posted: Sat Oct 31, 2015 11:40 am
by VictorDrummond
alber99 wrote:Is this still a problem in OC 2.0.3 ?
I've changed the name of my admin folder and sometimes experience incomplete extension installs using OCMOD - usually the upload step says "successful" but then the mod does not appear in Admin - so can't get beyond that step.
I have 2.03.1 + VQMOD + OCMOD... now with renamed ADMIN... It's not a problem at all...
Follow Q's tutorial to the letter, see this post:
http://forum.opencart.com/viewtopic.php?f=121&t=93109
Implemented 2 days ago, works perfectly.