3 /***************************************************************************
4 * Copyright (C) 2003-2011 Polytechnique.org *
5 * http://opensource.polytechnique.org/ *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
21 ***************************************************************************/
23 require './connect.db.inc.php';
25 function query ($sql) {
27 if (XDB
::errno() != 0) {
28 echo "error in \"$sql\":\n", XDB
::error(), "\n";
32 query('DELETE FROM register_pending
33 WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 365');
34 query('DELETE FROM register_pending
35 WHERE hash = \'INSCRIT\'');
37 // Sorts a few tables to optimize sorted read acces.
38 query('ALTER TABLE profile_binet_enum
40 query('ALTER TABLE profile_corps_enum
42 query('ALTER TABLE profile_corps_rank_enum
44 query('ALTER TABLE profile_education_degree_enum
46 query('ALTER TABLE profile_education_field_enum
48 query('ALTER TABLE profile_job_enum
50 query('ALTER TABLE profile_langskill_enum
52 query('ALTER TABLE profile_medal_enum
54 query('ALTER TABLE profile_networking_enum
56 query('ALTER TABLE profile_section_enum
58 query('ALTER TABLE profile_skill_enum
61 // Prunes older autocomplete queries.
62 query('DELETE FROM search_autocomplete
63 WHERE generated < DATE_SUB(NOW(), INTERVAL 1 DAY)');
65 // XXX: cleans profile_merge_issues (to be removed once all merge related issues have been fixed)
66 query('DELETE FROM profile_merge_issues
67 WHERE issues IS NULL OR issues = \'\'');
69 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: