Skip to content

Commit

Permalink
Postgresql fixes, and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgraham committed May 14, 2017
1 parent accecf5 commit 2b4eb65
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _tests/tests/unit_tests/_setup_wizard.php
Expand Up @@ -22,7 +22,7 @@ public function testFinalStep()
{
global $SITE_INFO;
if ((!isset($SITE_INFO['backdoor_ip'])) || ($SITE_INFO['backdoor_ip'] != '127.0.0.1')) {
warn_exit(protect_from_escaping('<kbd>backdoor_ip</kbd> must be set to <kbd>127.0.0.1</kbd> temporarily in <kbd>_config.php</kbd>, <kbd>$SITE_INFO[\'backdoor_ip\'] = \'127.0.0.1\';</kbd>'));
warn_exit(protect_from_escaping('<kbd>backdoor_ip</kbd> must be set to <kbd>127.0.0.1</kbd> temporarily until the test finishes running in <kbd>_config.php</kbd>, <kbd>$SITE_INFO[\'backdoor_ip\'] = \'127.0.0.1\';</kbd>'));
}

$post = array(
Expand Down
10 changes: 6 additions & 4 deletions _tests/tests/unit_tests/backups.php
Expand Up @@ -62,23 +62,25 @@ public function testBackup()
$config_php .= rtrim('
unset($SITE_INFO[\'base_url\']); // Let it auto-detect
unset($SITE_INFO[\'cns_table_prefix\']);
$SITE_INFO[\'db_site\'] = \'test\';
$SITE_INFO[\'db_forums\'] = \'test\';
$SITE_INFO[\'db_site\'] = \'cms_backup_test\';
$SITE_INFO[\'db_forums\'] = \'cms_backup_test\';
$SITE_INFO[\'table_prefix\'] = \'cms_backup_test_\';
$SITE_INFO[\'multi_lang_content\'] = \'' . addslashes($SITE_INFO['multi_lang_content']) . '\';
');
cms_file_put_contents_safe($config_path, $config_php);

$GLOBALS['SITE_DB']->query('CREATE DATABASE cms_backup_test', null, null, true);

for ($i = 0; $i < 2; $i++) {
$test = http_download_file(get_base_url() . '/exports/backups/test/restore.php?time_limit=1000', null, false, false, 'Composr', array(), null, null, null, null, null, null, null, 100.0);
$success = (strpos($test, do_lang('backups:BACKUP_RESTORE_SUCCESS')) !== false);
$this->assertTrue($success, 'Failed to run restorer script on iteration ' . strval($i + 1) . ' [' . $test . ']');
$this->assertTrue($success, 'Failed to run restorer script on iteration ' . strval($i + 1) . ' [' . $test . ']; to debug manually run exports/backups/test/restore.php?time_limit=1000');
if (!$success) {
return;
}
}

$db = new DatabaseConnector('test', get_db_site_host(), get_db_site_user(), get_db_site_password(), 'cms_backup_test_');
$db = new DatabaseConnector('cms_backup_test', get_db_site_host(), get_db_site_user(), get_db_site_password(), 'cms_backup_test_');
$count = $db->query_select_value('zones', 'COUNT(*)');
$this->assertTrue($count > 0, 'Failed to restore database');

Expand Down
7 changes: 6 additions & 1 deletion _tests/tests/unit_tests/shopping.php
Expand Up @@ -138,7 +138,12 @@ public function testAddtoCart()

public function testHandleTransaction()
{
$purchase_id = strval($GLOBALS['SITE_DB']->query_select_value('shopping_order', 'max(id)', array()));
$_purchase_id = $GLOBALS['SITE_DB']->query_select_value('shopping_order', 'MAX(id)', array());
if ($_purchase_id === null) {
$this->assertTrue(false, 'Order did not save');
return;
}
$purchase_id = strval($_purchase_id);
$item_name = lorem_phrase();
$payment_status = 'Completed';
$reason_code = '';
Expand Down
2 changes: 1 addition & 1 deletion _tests/tests/unit_tests/url_management.php
Expand Up @@ -23,7 +23,7 @@ public function testUrlToPageLink()
$zone_pathed = (get_option('collapse_user_zones') == '1') ? '' : 'site/';
$zone = (get_option('collapse_user_zones') == '1') ? '' : 'site';

$test = url_to_page_link(get_base_url() . '/' . $zone_pathed . '/pg/downloads/browse/test?foo=bar');
$test = url_to_page_link(get_base_url() . '/' . $zone_pathed . 'pg/downloads/browse/test?foo=bar');
$this->assertTrue($test == $zone . ':downloads:browse:test:foo=bar', 'Got wrong page-link for decode on PG scheme (' . $test . '), ' . $test);

$test = url_to_page_link(get_base_url() . '/' . $zone_pathed . 'downloads/browse/test?foo=bar');
Expand Down
2 changes: 1 addition & 1 deletion data_custom/functions.dat

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions data_custom/modules/user_export/out.csv
@@ -0,0 +1,201 @@
"Composr member ID","Username","E-mail address"
"2","admin",""
"3","test",""
"4","5917100fb8d4c","5917100fb8d512.66082269@example.com"
"5","591710112daed","591710112daf20.47119410@example.com"
"6","591710114a158","591710114a15b8.66874434@example.com"
"7","5917101163d75","5917101163d786.88007627@example.com"
"8","5917101180a10","5917101180a153.55452066@example.com"
"9","591710119a1ce","591710119a1d33.02935138@example.com"
"10","59171011b8488","59171011b848c0.52485894@example.com"
"11","59171011d305a","59171011d305e5.00514149@example.com"
"12","59171011ed5a5","59171011ed5aa0.09203215@example.com"
"13","59171012143b3","59171012143b78.62202249@example.com"
"14","591710122fbf7","591710122fbfb2.72245933@example.com"
"15","591710124dc46","591710124dc4a7.44603415@example.com"
"16","591710126dd5b","591710126dd602.85451889@example.com"
"17","591710128da2b","591710128da2f3.83649888@example.com"
"18","59171012ae0d0","59171012ae0d53.42508332@example.com"
"19","59171012cf65c","59171012cf6619.29835103@example.com"
"20","59171012f0a2a","59171012f0a2d5.98272696@example.com"
"21","591710131e088","591710131e08d7.29597366@example.com"
"22","591710133fc0e","591710133fc125.06068501@example.com"
"23","5917101361e7f","5917101361e826.66908889@example.com"
"24","591710138ad0a","591710138ad0f3.70627862@example.com"
"25","59171013addad","59171013addb02.36466380@example.com"
"26","59171013daf2c","59171013daf318.44896405@example.com"
"27","59171014067ba","59171014067be8.74671740@example.com"
"28","591710142a286","591710142a28c1.91758308@example.com"
"29","591710144e430","591710144e4335.73231128@example.com"
"30","591710146f57c","591710146f5816.74544791@example.com"
"31","5917101494a80","5917101494a852.38337858@example.com"
"32","59171014ba7b3","59171014ba7b70.38954879@example.com"
"33","59171014e000c","59171014e00106.45740097@example.com"
"34","5917101511e79","5917101511e7d7.42405721@example.com"
"35","5917101537fa1","5917101537fa56.80704097@example.com"
"36","5917101569e31","5917101569e348.32933362@example.com"
"37","59171015907cc","59171015907d02.77599589@example.com"
"38","59171015b75ea","59171015b75ee3.98566330@example.com"
"39","59171015db333","59171015db3388.98666577@example.com"
"40","591710160fa52","591710160fa580.51463936@example.com"
"41","59171016387f4","59171016387f90.50717419@example.com"
"42","591710166142a","591710166142e2.72929759@example.com"
"43","591710168a441","591710168a4454.13211539@example.com"
"44","59171016afd2c","59171016afd310.90138083@example.com"
"45","59171016d93d6","59171016d93dc3.35896769@example.com"
"46","5917101710526","591710171052c5.62280698@example.com"
"47","591710173aff2","591710173aff67.24030295@example.com"
"48","5917101765ae5","5917101765aea4.29366476@example.com"
"49","591710179a5f7","591710179a5fa3.78719040@example.com"
"50","59171017c5804","59171017c580a8.59190452@example.com"
"51","59171017f158e","59171017f15919.83756747@example.com"
"52","59171018257cc","59171018257d06.11817213@example.com"
"53","5917101852055","59171018520588.07332786@example.com"
"54","591710187f39a","591710187f39d8.18993743@example.com"
"55","59171018ac9aa","59171018ac9ae1.92489945@example.com"
"56","59171018da6dd","59171018da6e11.00576563@example.com"
"57","591710191f252","591710191f2554.39758179@example.com"
"58","591710194dc6b","591710194dc717.18667255@example.com"
"59","591710197d204","591710197d2077.25782583@example.com"
"60","59171019b66fb","59171019b67019.25605691@example.com"
"61","59171019e62a0","59171019e62a51.48878474@example.com"
"62","5917101a2d7c1","5917101a2d7c77.17397987@example.com"
"63","5917101a5dda9","5917101a5ddb09.80987463@example.com"
"64","5917101a8f5ff","5917101a8f6057.66086087@example.com"
"65","5917101acd735","5917101acd73b2.80387045@example.com"
"66","5917101b0bf39","5917101b0bf412.87432787@example.com"
"67","5917101b4d7db","5917101b4d7df3.46659864@example.com"
"68","5917101b7f56c","5917101b7f5719.04871333@example.com"
"69","5917101bb1ac7","5917101bb1acc6.78470538@example.com"
"70","5917101be4d1f","5917101be4d229.94857644@example.com"
"71","5917101c23d8f","5917101c23d939.44453249@example.com"
"72","5917101c5821c","5917101c582203.40865429@example.com"
"73","5917101c8b91b","5917101c8b9210.16259462@example.com"
"74","5917101cc02a3","5917101cc02a86.12608769@example.com"
"75","5917101d00479","5917101d0047d7.17827266@example.com"
"76","5917101d35f68","5917101d35f6c1.58754645@example.com"
"77","5917101d7f842","5917101d7f8461.27039177@example.com"
"78","5917101db5603","5917101db56076.88089777@example.com"
"79","5917101deb750","5917101deb7548.39728966@example.com"
"80","5917101e2e398","5917101e2e39b1.66374186@example.com"
"81","5917101e65ceb","5917101e65cef9.92420037@example.com"
"82","5917101e9cd49","5917101e9cd4d4.53871599@example.com"
"83","5917101ed483a","5917101ed483e0.82325601@example.com"
"84","5917101f19107","5917101f1910b8.39303060@example.com"
"85","5917101f51b50","5917101f51b558.70678070@example.com"
"86","5917101f8a508","5917101f8a50c2.11923464@example.com"
"87","5917101fc3076","5917101fc307a9.55746416@example.com"
"88","5917102004cef","5917102004cf42.07746724@example.com"
"89","59171020406f7","59171020406fc4.63767986@example.com"
"90","5917102076825","591710207682a7.71568291@example.com"
"91","59171020af49e","59171020af4a35.59244262@example.com"
"92","59171020e6a8c","59171020e6a913.75847085@example.com"
"93","591710212e9b5","591710212e9ba9.06393366@example.com"
"94","5917102166c62","5917102166c660.93888940@example.com"
"95","591710219dec3","591710219dec76.84052149@example.com"
"96","59171021d61cf","59171021d61d56.86250292@example.com"
"97","591710221b287","591710221b28b7.32099772@example.com"
"98","591710225416d","59171022541712.43509825@example.com"
"99","591710228e5fe","591710228e6028.00051412@example.com"
"100","59171022c792f","59171022c79326.16988021@example.com"
"101","591710230d838","591710230d83d6.42798241@example.com"
"102","59171023555a4","59171023555a89.13797180@example.com"
"103","5917102393c6b","5917102393c6f1.75077669@example.com"
"104","59171023d2fbe","59171023d2fc37.52637247@example.com"
"105","591710241e406","591710241e40a9.17690556@example.com"
"106","591710245a674","591710245a6786.00527481@example.com"
"107","591710249ac22","591710249ac262.91758701@example.com"
"108","59171024db6ca","59171024db6d72.34554687@example.com"
"109","5917102527ded","5917102527df14.59774558@example.com"
"110","5917102565215","59171025652192.18743477@example.com"
"111","59171025a70b4","59171025a70b80.11241235@example.com"
"112","59171025e90b4","59171025e90b97.56441781@example.com"
"113","59171026377a3","59171026377a88.84629008@example.com"
"114","591710267a062","591710267a0685.38057118@example.com"
"115","59171026bd2b6","59171026bd2bb6.04424492@example.com"
"116","5917102709c52","5917102709c567.99226101@example.com"
"117","591710274e081","591710274e0854.17678936@example.com"
"118","59171027916d0","59171027916d32.40257607@example.com"
"119","59171027d26e5","59171027d26e98.39997544@example.com"
"120","5917102823759","591710282375d0.27529951@example.com"
"121","5917102868566","59171028685866.08683749@example.com"
"122","59171028a963d","59171028a96400.58367929@example.com"
"123","59171028ef190","59171028ef1959.17167496@example.com"
"124","59171029415ef","59171029415f34.96817683@example.com"
"125","59171029880fb","59171029880fe1.99010458@example.com"
"126","59171029cf635","59171029cf63a4.61585352@example.com"
"127","5917102a1e97f","5917102a1e9830.21239359@example.com"
"128","5917102a670f8","5917102a670fd0.97862978@example.com"
"129","5917102aaedfb","5917102aaedff4.25025566@example.com"
"130","5917102b0d4e3","5917102b0d4e73.94341597@example.com"
"131","5917102b57c5c","5917102b57c615.63850728@example.com"
"132","5917102ba0f6e","5917102ba0f723.03097219@example.com"
"133","5917102bea482","5917102bea4855.64556374@example.com"
"134","5917102c3f515","5917102c3f5196.83679454@example.com"
"135","5917102c88a83","5917102c88a879.41765118@example.com"
"136","5917102cd3ac0","5917102cd3ac57.36361375@example.com"
"137","5917102d31c37","5917102d31c3b5.54293695@example.com"
"138","5917102d7d10e","5917102d7d1129.04471521@example.com"
"139","5917102dc7ea8","5917102dc7ead0.24368475@example.com"
"140","5917102e1fff8","5917102e1fffc5.21890984@example.com"
"141","5917102e674bd","5917102e674c00.46817925@example.com"
"142","5917102eb36c6","5917102eb36ca3.46486404@example.com"
"143","5917102f0a46b","5917102f0a46f4.03283526@example.com"
"144","5917102f57836","5917102f5783b5.87571152@example.com"
"145","5917102fa1648","5917102fa164d0.66199165@example.com"
"146","5917102feea01","5917102feea047.13460332@example.com"
"147","5917103044750","59171030447547.60364746@example.com"
"148","5917103093279","59171030932800.70480362@example.com"
"149","59171030de1cf","59171030de1d41.37099429@example.com"
"150","5917103138942","59171031389465.82546231@example.com"
"151","5917103184922","59171031849253.59710998@example.com"
"152","59171031d4011","59171031d40175.92018131@example.com"
"153","5917103233189","591710323318d0.17428958@example.com"
"154","59171032849cd","59171032849d13.17656291@example.com"
"155","59171032d58b5","59171032d58b98.59653105@example.com"
"156","591710333393a","591710333393e2.18413306@example.com"
"157","59171033853d2","59171033853d55.49441313@example.com"
"158","59171033d40fa","59171033d41001.87943701@example.com"
"159","5917103433440","59171034334446.86614216@example.com"
"160","5917103486c8b","5917103486c920.32841675@example.com"
"161","59171034d900a","59171034d900f4.66694389@example.com"
"162","5917103537b79","5917103537b7d3.05650096@example.com"
"163","591710358cf3b","591710358cf3f4.98612214@example.com"
"164","59171035dd6d8","59171035dd6db6.59098713@example.com"
"165","591710363e7e4","591710363e7e84.66519685@example.com"
"166","5917103693e26","5917103693e2a0.69807164@example.com"
"167","59171036e524e","59171036e52528.31050855@example.com"
"168","5917103747125","59171037471296.23232232@example.com"
"169","591710379d9d2","591710379d9d58.11141088@example.com"
"170","59171038006c0","59171038006c54.41791817@example.com"
"171","5917103857e83","5917103857e887.60519287@example.com"
"172","59171038af537","59171038af53c0.57077231@example.com"
"173","59171039136d3","59171039136d81.50250800@example.com"
"174","591710396bcab","591710396bcae8.82900823@example.com"
"175","59171039c0145","59171039c01493.11537936@example.com"
"176","5917103a24ee9","5917103a24eed3.18569885@example.com"
"177","5917103a7ead5","5917103a7ead92.29321303@example.com"
"178","5917103ad8505","5917103ad85088.22507019@example.com"
"179","5917103b3ddbb","5917103b3ddc03.88768916@example.com"
"180","5917103b95fd0","5917103b95fd33.08445303@example.com"
"181","5917103bf0eb0","5917103bf0eb48.70048371@example.com"
"182","5917103c57860","5917103c578652.57013063@example.com"
"183","5917103cb22d0","5917103cb22d48.39217535@example.com"
"184","5917103d1a3ae","5917103d1a3b18.86624058@example.com"
"185","5917103d762e6","5917103d762ea3.54945757@example.com"
"186","5917103dcf62f","5917103dcf6338.71114637@example.com"
"187","5917103e38511","5917103e385156.81112686@example.com"
"188","5917103e95b73","5917103e95b783.87085639@example.com"
"189","5917103ef3402","5917103ef34051.52271689@example.com"
"190","5917103f5d95c","5917103f5d9623.42876078@example.com"
"191","5917103fbc39e","5917103fbc3a38.29312463@example.com"
"192","5917104027142","59171040271456.47555933@example.com"
"193","5917104085c5e","5917104085c616.93803559@example.com"
"194","59171040e5439","59171040e543e3.27093636@example.com"
"195","5917104150fcf","5917104150fd24.73720818@example.com"
"196","59171041acbf9","59171041acbfc6.87378007@example.com"
"197","591710421a72c","591710421a74d3.69068423@example.com"
"198","591710427bc78","591710427bc7c0.67278691@example.com"
"199","59171042dd3a3","59171042dd3a96.19066762@example.com"
"200","591710434ad36","591710434ad3b7.66087652@example.com"
"203","test56",""
2 changes: 2 additions & 0 deletions git-hooks/pre-commit
Expand Up @@ -3,6 +3,8 @@

chdir(dirname(dirname(realpath(__FILE__))));

file_put_contents('data_custom/modules/user_export/out.csv', '');

if (git_repos() == 'composr_homesite') {
$issues = shell_exec('php delete_alien_files.php git_only');

Expand Down
2 changes: 1 addition & 1 deletion sources/catalogues.php
Expand Up @@ -1271,7 +1271,7 @@ function _get_catalogue_entry_field($field_id, $entry_id, $type = 'short', $only
if ($query != '') {
$query .= ' UNION ';
}
$query .= 'SELECT f.id AS f_id,'.db_cast('v.cv_value', 'CHAR');
$query .= 'SELECT f.id AS f_id,' . db_cast('v.cv_value', 'CHAR');
if (!multi_lang_content()) {
if (strpos($table, '_trans') !== false) {
$query .= ',v.cv_value__text_parsed,v.cv_value__source_user';
Expand Down
2 changes: 1 addition & 1 deletion sources/comcode_renderer.php
Expand Up @@ -1681,7 +1681,7 @@ function _do_tags_comcode($tag, $attributes, $embed, $comcode_dangerous, $pass_i
$attributes['target'] = '_blank';
}
if (array_key_exists('rel', $attributes)) {
$rel = trim($rel . ' ' . $attributes['rel']);
$rel = trim($attributes['rel']);
} else {
$rel = '';
}
Expand Down
Expand Up @@ -178,6 +178,7 @@ public function get_file_list()
'sources/hooks/systems/config/automatic_meta_extraction.php',
'sources/hooks/systems/config/bcc.php',
'sources/hooks/systems/config/bottom_show_feedback_link.php',
'sources/hooks/systems/config/autogrow.php',
'sources/hooks/systems/config/bottom_show_rules_link.php',
'sources/hooks/systems/config/bottom_show_privacy_link.php',
'sources/hooks/systems/config/bottom_show_sitemap_button.php',
Expand Down
4 changes: 2 additions & 2 deletions sources/hooks/systems/ecommerce/catalogue_items.php
Expand Up @@ -712,11 +712,11 @@ public function get_custom_product_map_fields($id, &$map)
/**
* Update order status,transaction ID after transaction.
*
* @param AUTO_LINK $entry_id Purchase/Order ID.
* @param ID_TEXT $entry_id Purchase/Order ID.
* @param array $details Details of product.
*/
function handle_catalogue_items($entry_id, $details)
{
$object = object_factory('Hook_ecommerce_catalogue_items');
$object->update_stock($entry_id, 1);
$object->update_stock(intval($entry_id), 1);
}
2 changes: 1 addition & 1 deletion sources/hooks/systems/fields/codename.php
Expand Up @@ -175,7 +175,7 @@ public function get_field_random($field_id, $default = '')
if (!addon_installed('catalogues')) {
break;
}
$test = $GLOBALS['SITE_DB']->query_select_value_if_there('catalogue_efv_integer', 'ce_id', array('cv_value' => $value, 'cf_id' => $field_id));
$test = $GLOBALS['SITE_DB']->query_select_value_if_there('catalogue_efv_short', 'ce_id', array('cv_value' => $value, 'cf_id' => $field_id));
} while (!is_null($test));

return $value;
Expand Down

0 comments on commit 2b4eb65

Please sign in to comment.