Matrix 4.0 Backup


(Tbaatar) #1

Hi,


I’m trying to backup Matrix 4.0.0 and restore it from another server and having some difficulty. I followed the Matrix Management Guide.



I’m get the following error when I try to edit/view/create asset when matrix is restored on the new server.


    Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_get_lineage_treeids(unknown, unknown) does not exist LINE 1: SELECT sq_get_lineage_treeids AS treeid FROM sq_get_lineage_... ^ 
    
    HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /home/websites/mysource_matrix/core/include/asset_manager.inc(3638): DAL::executePdoAssoc(Object(PDOStatement)) #1 /home/websites/mysource_matrix/core/include/general.inc(1489): 
    
    Asset_Manager->getLinkLineages(153, 5, NULL, 'name', true) #2 /home/websites/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(153) #3 /home/websites/mysource_matrix/core/include/asset.inc(4776): Asset_Edit_Interface->paint(Object(Page_Standard), Object(Backend_Outputter), false) #4 /home/websites/mysource_matrix/core/assets/page_templates/page_st in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 658



Any pointers or help much appreciated.

Thanks.

(Chris Smith) #2

Hi,


If you run step 2 it should fix these up:


    
    php /path/to/matrix/install/step_02.php /path/to/matrix


[quote]
Hi,

I'm trying to backup Matrix 4.0.0 and restore it from another server and having some difficulty. I followed the Matrix Management Guide.

I'm get the following error when I try to edit/view/create asset when matrix is restored on the new server.

    Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_get_lineage_treeids(unknown, unknown) does not exist LINE 1: SELECT sq_get_lineage_treeids AS treeid FROM sq_get_lineage_... ^ 
HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /home/websites/mysource_matrix/core/include/asset_manager.inc(3638): DAL::executePdoAssoc(Object(PDOStatement)) #1 /home/websites/mysource_matrix/core/include/general.inc(1489): 

Asset_Manager->getLinkLineages(153, 5, NULL, 'name', true) #2 /home/websites/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(153) #3 /home/websites/mysource_matrix/core/include/asset.inc(4776): Asset_Edit_Interface->paint(Object(Page_Standard), Object(Backend_Outputter), false) #4 /home/websites/mysource_matrix/core/assets/page_templates/page_st in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 658</pre><br />


Any pointers or help much appreciated.

Thanks.
[/quote]

(Tbaatar) #3

[quote]
Hi,



If you run step 2 it should fix these up:


    
    php /path/to/matrix/install/step_02.php /path/to/matrix

[/quote]





Hi,



I ran the step 2 of the installation and still had the same problem.



But we did manage to fix the problem by copying the following files (version 4 files) to the new server.


    
    $ cp -r /home/websites/mysource_matrix_3-x-y/data .
    $ cp -r /home/websites/mysource_matrix_3-x-y/core/lib/DAL/Oven core/lib/DAL
    $ cp -r /home/websites/mysource_matrix_3-x-y/core/lib/DAL/QueryStore core/lib/DAL

(Chris Smith) #4

Hmm that's weird, all of that should have been included in the backup file.

[quote]

Hi,



I ran the step 2 of the installation and still had the same problem.



But we did manage to fix the problem by copying the following files (version 4 files) to the new server.


    
    $ cp -r /home/websites/mysource_matrix_3-x-y/data .
    $ cp -r /home/websites/mysource_matrix_3-x-y/core/lib/DAL/Oven core/lib/DAL
    $ cp -r /home/websites/mysource_matrix_3-x-y/core/lib/DAL/QueryStore core/lib/DAL

[/quote]


(Duncan Robertson) #5

That's what I thought too. We solved by rsync'ing those files over, resetting permissions and hard rebooting. I'm not sure if Squiz has done a SM4 backup and move successfully, or we've done something wrong? Anyway, it's all sorted now and the new cloud servers are working like a frickin' dream.


(Benjamin Pearson) #6

[quote]
That's what I thought too. We solved by rsync'ing those files over, resetting permissions and hard rebooting. I'm not sure if Squiz has done a SM4 backup and move successfully, or we've done something wrong? Anyway, it's all sorted now and the new cloud servers are working like a frickin' dream.

[/quote]



It would possibly require further investigation but the backup script is the same as 3.26 and 3.28 and I don't think anything has changed in DAL between 3.28 and 4.0, so a 4.0 backup and restore should behave the same as 3.2x backup and restore (from a code point of view anyhow).


(Duncan Robertson) #7

Did you guys investigate any further?


(Chris Smith) #8

Hi,

[quote]

Did you guys investigate any further?

[/quote]



The script hasn't changed in a few major releases so I'm not sure how it would be the script. If you create a backup again now does it contain those files? This should check:



tar -tzvf $backup.tar.gz | grep -i dal



(may take a while depending on size of the tarball).


(Neil Newman) #9

We have hit the same issue, whilst carrying out a backup of our live site, which we then attempted to load onto a test machine, error given:
[size="1"][/size]Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 46 HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /home/websites/mysource_matrix/core/include/asset_manager.inc(3755): DAL::executePdoAssoc(Object(PDOStatement)) #1 /home/websites/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(13, 5, NULL, 'name', true) #2 /home/websites/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(13) #3 /home/websites/mysource_matrix/core/include/asset.inc(4982): Asset_Edit_Interface->paint(Object(Inbox), Object(Backend_Outputter), false) #4 /home/websites/mysource_matrix/core/assets/users/inbox/inbox.inc(163): Asset->paintBackend(Object(Backend_Outputter)) #5 /home/websites/mysource_matrix/core/include/ass in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 658[size="2"][/size]



I tried to re-run step_02 but that generated the following:

php /home/websites/mysource_matrix/install/step_02.php /home/websites/mysource_matrix

----------------------------------

<?php

define('SQ_CONF_PEAR_PATH', SQ_SYSTEM_ROOT.'/php_includes');

$inc_dir = ini_get('include_path');

$inc_dir = (substr($inc_dir, 0, 2) == '.:') ? '.:'.SQ_CONF_PEAR_PATH.':'.substr($inc_dir, 2) : SQ_CONF_PEAR_PATH.':'.$inc_dir;

ini_set('include_path', $inc_dir);



define('SQ_CONF_BACKEND_SUFFIX', '_admin');

define('SQ_CONF_LIMBO_SUFFIX', '_edit');

define('SQ_CONF_LOGIN_SUFFIX', '_login');

define('SQ_CONF_NOCACHE_SUFFIX', '_nocache');

define('SQ_CONF_RECACHE_SUFFIX', '_recache');

define('SQ_CONF_ASSET_TREE_BASE', 64);

define('SQ_CONF_ASSET_TREE_SIZE', 4);

define('SQ_CONF_ASSET_CACHE_SIZE_WEB', -1);

define('SQ_CONF_ASSET_CACHE_SIZE_CLI', -1);

define('SQ_CONF_ROLLBACK_ENABLED', '0');

define('SQ_CONF_DEBUG', '0');

define('SQ_CONF_SYSTEM_NAME', 'The System');

define('SQ_CONF_SYSTEM_OWNER', '');

define('SQ_CONF_SYSTEM_ROOT_URLS', 'matrix.dartford.gov.uk

matrix.twkp.co.uk

www.dartford.gov.uk

dbc.twkp.co.uk

www.gravesham.gov.uk

gbc.twkp.co.uk

www.sevenoaks.gov.uk

sdc.twkp.co.uk

www.tmbc.gov.uk

tmbc.twkp.co.uk');

define('SQ_CONF_SYSTEM_PARENT_DOMAINS', '');

define('SQ_CONF_STATIC_ROOT_URL', '');

define('SQ_CONF_WEB_PATH_SEPARATOR', '-');

define('SQ_CONF_STATIC_ROOT_HTTP', '1');

define('SQ_CONF_STATIC_ROOT_HTTPS', '0');

define('SQ_CONF_DEFAULT_EMAIL', 'its@dartford.gov.uk');

define('SQ_CONF_TECH_EMAIL', 'its@dartford.gov.u');

define('SQ_CONF_MAX_LOGIN_ATTEMPTS', '3');

define('SQ_CONF_REFRESH_INTERVAL', 120);

define('SQ_CONF_LOCK_LENGTH', 600);

define('SQ_CONF_ASSET_MAP_ASSET_LIMIT', '50');

define('SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME', '%asset_short_name% (%asset_assetid%)');

define('SQ_CONF_SEND_CACHEABLE_HEADER', '0');

define('SQ_CONF_SEND_LAST_MODIFIED_HEADER', '0');

define('SQ_CONF_SEND_NOT_MODIFIED_HEADER', '0');

define('SQ_CONF_SEND_NO_CACHE_HEADER', '0');

define('SQ_CONF_SEND_404_CACHEABLE_HEADER', '0');

define('SQ_CONF_USE_HTTP_X_FORWARDED_FOR', '0');

define('SQ_CONF_FORWARDED_IP_PROXY_LIST', '');

define('SQ_CONF_ERRORS_LOG_TO_SYSLOG', '0');

define('SQ_CONF_ERRORS_SYSLOG_FACILITY', 'user');

define('SQ_CONF_ERRORS_HIDE_FRONTEND', '0');

define('SQ_CONF_DEFAULT_FRONTEND_LANGUAGE', 'en');

define('SQ_CONF_DEFAULT_BACKEND_LOCALE', 'en_GB');

define('SQ_CONF_DEFAULT_CHARACTER_SET', 'utf-8');

define('SQ_CONF_USE_LANG_CHAR_MAP', '0');

define('SQ_CONF_ALLOW_IP_CHANGE', '0');

define('SQ_CONF_ALLOW_HTTP_LOGIN', '0');

define('SQ_CONF_ENABLE_HTTP_LOGIN', '0');

define('SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS', '1');

define('SQ_CONF_HTTP_LOGIN_VAR', 'REMOTE_USER');

define('SQ_CONF_ACCEPT_HTTP_CREDS', '0');

define('SQ_CONF_COMMIT_BUTTON_TEXT', 'Commit');

define('SQ_CONF_CONFIRM_SAVE_CHANGES', '1');

define('SQ_CONF_LOG_EXTENSION', '.log');

define('SQ_CONF_LOG_FILE_SYSTEM', 'system');

define('SQ_CONF_LOG_FILE_ERROR', 'error');

ini_set('error_log', SQ_LOG_PATH.'/'.SQ_CONF_LOG_FILE_ERROR.SQ_CONF_LOG_EXTENSION);

define('SQ_CONF_LOG_ERRORS', '1');

ini_set('log_errors', '1');

define('SQ_CONF_LOCKING_METHOD', 'default');

define('SQ_CONF_SESSION_HANDLER', '');

define('SQ_CONF_SESSION_GC_MAXLIFETIME', 604800);

ini_set('session.gc_maxlifetime', 604800);

define('SQ_CONF_EDITING_TIME', 3600);

define('SQ_CONF_NUM_DATA_DIRS', 20);

define('SQ_CONF_FORCE_SECURE_LOGIN_URLS', '');

define('SQ_CONF_WEB_MEMORY_LIMIT', '64');

define('SQ_CONF_CRON_MEMORY_LIMIT', '64');

define('SQ_CONF_USE_DEFAULT_SESSION_SAVE_PATH', '0');

define('SQ_CONF_CUSTOM_SESSION_SAVE_PATH', '');

define('SQ_CONF_ENABLE_ROLES_PERM_SYSTEM', '0');

define('SQ_CONF_ENABLE_ROLES_WF_SYSTEM', '0');

define('SQ_CONF_ENABLE_GLOBAL_ROLES', false);

define('SQ_CONF_NO_ASSET_SELF_LINKS', '0');

define('SQ_CONF_TIMEZONE', 'Europe/London');

define('SQ_CONF_FORCE_LOWERCASE_USERNAME', false);

define('SQ_LICENCE_INSTALL_KEY', '64def3f09d04c2275b960c8bcb4fe4c9');

define('SQ_LICENCE_WARRANTY_KEY', 'NjRkZWYzMDAxNDE0dWsyMDEyMDIwMw==');

define('SQ_CONF_COOKIE_OPTION_HTTP_ONLY', false);

define('SQ_CONF_COOKIE_OPTION_SECURE', false);

?>

----------------------------------



Fatal error: Uncaught exception 'DALException' with message 'DBError!:SQLSTATE[42704]: Undefined object: 7 ERROR: language "plpgsql" does not exist

HINT: Use CREATE LANGUAGE to load the language into the database.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:909

Stack trace:

#0 /home/websites/mysource_matrix/core/lib/db_install/db_install.inc(837): DAL::executeSql('-- creates a fu…')

#1 /home/websites/mysource_matrix/install/step_02.php(101): install_stored_relations('functions')

#2 {main}

thrown in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 909



Any ideas what is going wrong here?, I don't have a copy of the source files to hand as they are on a remote site


(Chris Smith) #10

[quote]
We have hit the same issue, whilst carrying out a backup of our live site, which we then attempted to load onto a test machine, error given:

[size="1"][/size]Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 46 HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /home/websites/mysource_matrix/core/include/asset_manager.inc(3755): DAL::executePdoAssoc(Object(PDOStatement)) #1 /home/websites/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(13, 5, NULL, 'name', true) #2 /home/websites/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(13) #3 /home/websites/mysource_matrix/core/include/asset.inc(4982): Asset_Edit_Interface->paint(Object(Inbox), Object(Backend_Outputter), false) #4 /home/websites/mysource_matrix/core/assets/users/inbox/inbox.inc(163): Asset->paintBackend(Object(Backend_Outputter)) #5 /home/websites/mysource_matrix/core/include/ass in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 658[size="2"][/size]



I tried to re-run step_02 but that generated the following:

php /home/websites/mysource_matrix/install/step_02.php /home/websites/mysource_matrix

----------------------------------



----------------------------------



Fatal error: Uncaught exception 'DALException' with message 'DBError!:SQLSTATE[42704]: Undefined object: 7 ERROR: language "plpgsql" does not exist

HINT: Use CREATE LANGUAGE to load the language into the database.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:909

Stack trace:

#0 /home/websites/mysource_matrix/core/lib/db_install/db_install.inc(837): DAL::executeSql('-- creates a fu…')

#1 /home/websites/mysource_matrix/install/step_02.php(101): install_stored_relations('functions')

#2 {main}

thrown in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 909



Any ideas what is going wrong here?, I don't have a copy of the source files to hand as they are on a remote site

[/quote]



If you do

    
    createlang -U postgres plpgsql $matrix_db_name

and substitute the real matrix database name in, that will let you run step 2 properly (which will fix up the missing functions you had originally).


(Benjamin Pearson) #11

[quote]
Fatal error: Uncaught exception 'DALException' with message 'DBError!:SQLSTATE[42704]: Undefined object: 7 ERROR: language "plpgsql" does not exist

HINT: Use CREATE LANGUAGE to load the language into the database.' in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc:909

Stack trace:

#0 /home/websites/mysource_matrix/core/lib/db_install/db_install.inc(837): DAL::executeSql('-- creates a fu…')

#1 /home/websites/mysource_matrix/install/step_02.php(101): install_stored_relations('functions')

#2 {main}

thrown in /home/websites/mysource_matrix/core/lib/DAL/DAL.inc on line 909



Any ideas what is going wrong here?, I don't have a copy of the source files to hand as they are on a remote site

[/quote]



When creating the database did you run the createlang (createlang -U postgres plpgsql $matrix_db_name) step?



*EDIT: Beaten by Chris.


(Neil Newman) #12

[quote]
If you do

    
    createlang -U postgres plpgsql $matrix_db_name

and substitute the real matrix database name in, that will let you run step 2 properly (which will fix up the missing functions you had originally).

[/quote]







Thanks for the info, that fixed the problem