|
@@ -54,19 +54,17 @@ def update_database():
|
|
|
for pub in result:
|
|
|
id = int(pub['wpid'])
|
|
|
|
|
|
-
|
|
|
- if (id > 0):
|
|
|
- if not wordpress_get_post(id):
|
|
|
- print "Marking post %d as ununsed; deleting citations" % id
|
|
|
-
|
|
|
- sql = "DELETE FROM `citations` WHERE `wpid` = %s"
|
|
|
- cursor.execute(sql, (id) )
|
|
|
-
|
|
|
- sql = "UPDATE `publications` SET `wpid` = 0 WHERE `wpid` = %s"
|
|
|
- cursor.execute(sql, (id) )
|
|
|
- npubs += 1
|
|
|
-
|
|
|
-
|
|
|
+ if not wordpress_get_post(id):
|
|
|
+ print "Marking post %d as ununsed; deleting citations" % id
|
|
|
+
|
|
|
+ sql = "DELETE FROM `citations` WHERE `wpid` = %s"
|
|
|
+ cursor.execute(sql, (id) )
|
|
|
+
|
|
|
+ sql = "UPDATE `publications` SET `wpid` = 0 WHERE `wpid` = %s"
|
|
|
+ cursor.execute(sql, (id) )
|
|
|
+ npubs += 1
|
|
|
+
|
|
|
+
|
|
|
# connection is not autocommit by default. So you must commit to save
|
|
|
# your changes.
|
|
|
connection.commit()
|