I wonder if there is a debugger or verbose setting so we can follow it onscreen on exactly what it's doing... and not just stop at the error point. I want to see what it's trying to do before it broke.
Anyway, here are my steps. I'll stuck at Error 1.
Here are the general steps of our moodle upgrade
1.9.14+ (Production aka "PROD") to 2.0.7+ (Test 2.0.7+ server aka "T1 Test Server")
1. Download the latest 2.0.7+ moodle release on T1 in a directory other than the directory where moodle would be delivered (i.e save it in your home directory). This code base is basic in that it does not have any custom plugins.
2. Unzip/extract the 2.0.7+ moodle code base. This will extract and creat a "moodle directory" and we will use it later when we do the upgrade.
3. Backup production database on PROD
4. Backup production moodle data on PROD
5. Copy all of PROD moodle source code to the T1 test server except "config.php". This will also copy over all the custom 1.9.14+ blocks and plugins.
6. Copy over the backup production database over to T1 test server.
7. Copy over the contents in the PROD moodle data directory over to the moodle data directory on T1 Test Server.
8. Restore the backup production database on T1 Test Server.
9. On T1 Test Server, run the 1.9.14+ install procedure again (no problems). This will create a “config.php” file for this 1.9.14 instance on T1 Test Server. This is the config.php file we will use to upgrade to 2.0.7 on KELTW11. Check indexes and bigints columns under the experimental administrative menu (no problems).
10. Save a copy of the “config.php” file created in step 9 above to your home (or another) directory.
11. Delete all moodle 1.9.14+ code base on T1 Test Server (ie. now an empty directory where the 1.9.14+ use to be).
12. Next, copy over all the moodle 2.0.7 code base files you extracted in step 2 over to the “moodle directory” where the site is configured in T1 Test Server.
13. Next, copy over the “config.php” file you save in step 10 (ie. the 1.9.14+ config.php") over to the 2.0.7+ moodle root directory. The upgrade process looks at this config.php file to see which database it needs to connect to.
14. Start the upgrade via command line (sudo -u apache /usr/bin/php /var/www/html/mymoodle2test/admin/cli/upgrade.php) option.
15. Once the upgrade starts, the process will be monitored to ensure there are no immediate errors. Errors will occur and it will be displayed in this area with and must be fixed before going any further. As it’s possible to receive a wide variation of errors, the error will have to be handled on a per-issue base.
16. If we are lucky enough to have no errors, then we can test basic moodle functions.
17. If the tests in step 15 are fine, then we can install and test the custom plugins for version 2.0.7+
18. Once all the above steps are executed without errors, we can proceed to upgrade to 2.1.4+
I have both turned on debugging at application level (Developer, show all) and in my config.php
$CFG->debug = 38911;
$CFG->debugdisplay = 1;
I cannot get past number 14... tables and columns were never created ... this is the first of 2 errors:
--------------
ERROR 1:
-------------
++ Success ++
-->mod_data
++ Success ++
-->mod_feedback
++ Success ++
-->mod_folder
Default exception handler: Error writing to database Debug: Duplicate entry '9900' for key 'mdl_resoold_old_uix'
INSERT INTO mdl_resource_old (oldid, course, name, type, reference, intro, introformat, alltext, popup, options, timemodified, cmid)
SELECT r.id, r.course, r.name, r.type, r.reference, r.summary, 0, r.alltext, r.popup, r.options, r.timemodified, cm.id
FROM mdl_resource r
LEFT JOIN mdl_course_modules cm ON (r.id = cm.instance AND cm.module = ?)
[array (
0 => '13',
)]
* line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 722 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 258 of /mod/resource/db/upgradelib.php: call to mysqli_native_moodle_database->execute()
* line 46 of /mod/folder/db/upgradelib.php: call to resource_20_prepare_migration()
* line 39 of /mod/folder/db/install.php: call to folder_20_migrate()
* line 514 of /lib/upgradelib.php: call to xmldb_folder_install()
* line 271 of /lib/upgradelib.php: call to upgrade_plugins_modules()
* line 1436 of /lib/upgradelib.php: call to upgrade_plugins()
* line 146 of /admin/cli/upgrade.php: call to upgrade_noncore()
!!! Error writing to database !!!
!! Duplicate entry '9900' for key 'mdl_resoold_old_uix'
INSERT INTO mdl_resource_old (oldid, course, name, type, reference, intro, introformat, alltext, popup, options, timemodified, cmid)
SELECT r.id, r.course, r.name, r.type, r.reference, r.summary, 0, r.alltext, r.popup, r.options, r.timemodified, cm.id
FROM mdl_resource r
LEFT JOIN mdl_course_modules cm ON (r.id = cm.instance AND cm.module = ?)
[array (
0 => '13',
)] !!
!! Stack trace: * line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 722 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 258 of /mod/resource/db/upgradelib.php: call to mysqli_native_moodle_database->execute()
* line 46 of /mod/folder/db/upgradelib.php: call to resource_20_prepare_migration()
* line 39 of /mod/folder/db/install.php: call to folder_20_migrate()
* line 514 of /lib/upgradelib.php: call to xmldb_folder_install()
* line 271 of /lib/upgradelib.php: call to upgrade_plugins_modules()
* line 1436 of /lib/upgradelib.php: call to upgrade_plugins()
* line 146 of /admin/cli/upgrade.php: call to upgrade_noncore()
!!
I went to check the index ...
mysql> show index from mdl_resource_old;
+------------------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+------------------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| mdl_resource_old | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | |
| mdl_resource_old | 0 | mdl_resoold_old_uix | 1 | oldid | A | 0 | NULL | NULL | | BTREE | |
| mdl_resource_old | 1 | mdl_resoold_cmi_ix | 1 | cmid | A | 0 | NULL | NULL | YES | BTREE | |
+------------------+------------+---------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
to check I wrote ....
mysql> select * from mdl_course_modules where instance = '9900';
+--------+--------+--------+----------+---------+----------+------------+-------+--------+---------+------------+-----------+------------+------------------+------------+---------------------------+----------------+--------------------+---------------+----------------+------------------+
| id | course | module | instance | section | idnumber | added | score | indent | visible | visibleold | groupmode | groupingid | groupmembersonly | completion | completiongradeitemnumber | completionview | completionexpected | availablefrom | availableuntil | showavailability |
+--------+--------+--------+----------+---------+----------+------------+-------+--------+---------+------------+-----------+------------+------------------+------------+---------------------------+----------------+--------------------+---------------+----------------+------------------+
| 21283 | 474 | 13 | 9900 | 6405 | NULL | 1204764449 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | NULL | 0 | 0 | 0 | 0 | 0 |
| 21300 | 474 | 13 | 9900 | 6411 | NULL | 1204764449 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | NULL | 0 | 0 | 0 | 0 | 0 |
| 119243 | 1511 | 12 | 9900 | 23098 | NULL | 1216148337 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | NULL | 0 | 0 | 0 | 0 | 0 |
| 209763 | 2166 | 1 | 9900 | 33982 | | 1323845265 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | NULL | 0 | 0 | 0 | 0 | 0 |
+--------+--------+--------+----------+---------+----------+------------+-------+--------+---------+------------+-----------+------------+------------------+------------+---------------------------+----------------+--------------------+---------------+----------------+------------------+
4 rows in set (0.01 sec)
--------------
ERROR 2
--------------
http://tracker.moodle.org/browse/MDL-25248
I'm stuck at error 1. How do i find the so called duplicate?
thank you.