root/buddyloo/files/lib/system/cronjob/BuddylooSocialCleanupCronjob.class.php @ 1285

Revision 1285, 1.0 kB (checked in by Torben Brodt, 2 years ago)

move twitter base package

  • Property svn:executable set to *
Line 
1<?php
2require_once(WCF_DIR.'lib/data/cronjobs/Cronjob.class.php');
3
4/**
5 * cleans up empty social pages
6 *
7 * @author      Torben Brodt
8 * @package     de.easy-coding.wcf.buddyloo
9 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
10 */
11class BuddylooSocialCleanupCronjob implements Cronjob {
12       
13        /**
14         * @see Cronjob::execute()
15         */
16        public function execute($data) {
17                // (1)
18                $sql = "DELETE FROM a USING wcf1_buddyloo_social a LEFT JOIN wcf1_buddyloo_gadget_to_social b USING(socialID) WHERE ISNULL(b.socialID);";
19                WCF::getDB()->sendQuery($sql);
20
21                // (2)
22                $sql = "DELETE FROM a USING wcf1_buddyloo_user_to_social a LEFT JOIN wcf1_buddyloo_social b USING(socialID) WHERE ISNULL(b.socialID);";
23                WCF::getDB()->sendQuery($sql);
24
25                // (3)
26                $sql = "UPDATE wcf1_user a, (
27                                SELECT a.userid FROM wcf1_user a LEFT JOIN wcf1_buddyloo_social b USING(socialID) WHERE a.socialID > 0 AND ISNULL(b.socialID)
28                        ) b
29                        SET socialID = 0
30                        WHERE a.userID = b.userID;";
31                WCF::getDB()->sendQuery($sql);
32        }
33}
34?>
Note: See TracBrowser for help on using the browser.