Joomlatools Support Center

DEFINER not updated when existing website and database is copied to a new site & db

We often generate new websites by copying the Joomla! directory, and the corresponding database.

For example, we copy the files from SITE to SITE_COPY, and the database is copied from DB to DB_COPY. The database user is copied from USER to USER_COPY.

However, this causes a problem with the DOCman views j##_docman_file_counts and j##_docman_nodes. These views have an explicit reference to the original database username, preventing us from backing up the new database (DB_COPY).

The line in both views is:
/*!50013 DEFINER=`USER`@`webdesign.sas.rutgers.edu` SQL SECURITY DEFINER */

when it should be

/*!50013 DEFINER=`USER_COPY`@`webdesign.sas.rutgers.edu` SQL SECURITY DEFINER */

We can fix the problem by either:

a) exporting DOCman data, uninstalling DOCman, reinstalling DOCman, and importing the data, or

b) manually modifying the views in the database.

However, I would like to alert you to this issue. Would it make sense to replace the explicit username in the view with the variable "$user" so that the actual database user is called from configuration.php?

Answer

Posted 2 years ago by Arunas Mazeika Staff

Hello Stephen,

This is a problem with your backup tool which is creating the DB dumps. The queries for re-creating your tables are being made against the user that created the views. If you want this changed you need a script that will rename this as you manually did before aplying them.

This is not really a DOCman issue.

Subscribe or login to join the discussion!

Stephen Goldklank
09.08.17
Answered

System Information

3.0
n/a
n/a