|
@@ -125,7 +125,32 @@ class WikiPage
|
125
|
125
|
$con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
|
126
|
126
|
or die ("Could not connect to server\n");
|
127
|
127
|
|
128
|
|
- $query = "UPDATE contents SET is_archive = TRUE WHERE permalink = $1 AND type='wiki'";
|
|
128
|
+ $query = "UPDATE contents SET is_public=FALSE WHERE permalink=$1 AND type='wiki'";
|
|
129
|
+
|
|
130
|
+ pg_prepare($con, "prepare1", $query)
|
|
131
|
+ or die ("Cannot prepare statement\n");
|
|
132
|
+ $result = pg_execute($con, "prepare1", array($this->permalink))
|
|
133
|
+ or die ("Cannot execute statement\n");
|
|
134
|
+
|
|
135
|
+ pg_close($con);
|
|
136
|
+
|
|
137
|
+ error_log(
|
|
138
|
+ date('r')." \t".$user->name." (".$user->id.") \tDELETE \tUnpublish wiki page '".$this->permalink."'\r\n",
|
|
139
|
+ 3,
|
|
140
|
+ $config['logs_folder'].'wiki.log');
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ /*****
|
|
144
|
+ ** Restore a page from unpublishing it
|
|
145
|
+ *****/
|
|
146
|
+ public function restore() {
|
|
147
|
+ global $config;
|
|
148
|
+ global $user;
|
|
149
|
+
|
|
150
|
+ $con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
|
|
151
|
+ or die ("Could not connect to server\n");
|
|
152
|
+
|
|
153
|
+ $query = "UPDATE contents SET is_public=TRUE WHERE permalink=$1 AND type='wiki'";
|
129
|
154
|
|
130
|
155
|
pg_prepare($con, "prepare1", $query)
|
131
|
156
|
or die ("Cannot prepare statement\n");
|
|
@@ -135,7 +160,7 @@ class WikiPage
|
135
|
160
|
pg_close($con);
|
136
|
161
|
|
137
|
162
|
error_log(
|
138
|
|
- date('r')." \t".$user->name." (".$user->id.") \tDELETE \tArchive wiki page '".$this->permalink."'\r\n",
|
|
163
|
+ date('r')." \t".$user->name." (".$user->id.") \tRESTORE \tPublish wiki page '".$this->permalink."'\r\n",
|
139
|
164
|
3,
|
140
|
165
|
$config['logs_folder'].'wiki.log');
|
141
|
166
|
}
|