@@ -130,6 +130,7 @@ public function getSyncList() {
130130 * @param string $summary the editing summary
131131 */
132132 public function syncFile ($ type , $ id , $ dir , $ summary ) {
133+ $ this ->client ->setFileContext ($ id );
133134 switch ($ dir ) {
134135 case self ::DIR_PULL :
135136 $ this ->syncPull ($ type , $ id , $ summary );
@@ -146,6 +147,7 @@ public function syncFile($type, $id, $dir, $summary) {
146147 default :
147148 // skip
148149 }
150+ $ this ->client ->setFileContext ('' );
149151 }
150152
151153 /**
@@ -154,11 +156,11 @@ public function syncFile($type, $id, $dir, $summary) {
154156 * @param int $type pages|media
155157 * @param string $id the ID of the page or media
156158 * @param string $summary the editing summary
157- * @throws SyncException
159+ * @throws SyncFileException
158160 */
159161 protected function syncPull ($ type , $ id , $ summary ) {
160162 if ($ type === self ::TYPE_PAGES ) {
161- if (checklock ($ id )) throw new SyncException ( ' Local file is locked ' );
163+ if (checklock ($ id )) throw new SyncFileException ( ' lockfail ' , $ id );
162164 $ this ->client ->query ('wiki.getPage ' , $ id );
163165 } else {
164166 $ this ->client ->query ('wiki.getAttachment ' , $ id );
@@ -179,14 +181,14 @@ protected function syncPull($type, $id, $summary) {
179181 * @param int $type pages|media
180182 * @param string $id the ID of the page or media
181183 * @param string $summary the editing summary
182- * @throws SyncException
184+ * @throws SyncFileException
183185 */
184186 protected function syncPullDelete ($ type , $ id , $ summary ) {
185187 if ($ type === self ::TYPE_PAGES ) {
186- if (checklock ($ id )) throw new SyncException ( ' Local file is locked ' );
188+ if (checklock ($ id )) throw new SyncFileException ( ' lockfail ' , $ id );
187189 saveWikiText ($ id , '' , $ summary , false );
188190 } else {
189- if (!unlink (mediaFN ($ id ))) throw new SyncException ( ' File deletion failed ' );
191+ if (!unlink (mediaFN ($ id ))) throw new SyncFileException ( ' localdelfail ' , $ id );
190192 }
191193 }
192194
@@ -196,7 +198,7 @@ protected function syncPullDelete($type, $id, $summary) {
196198 * @param int $type pages|media
197199 * @param string $id the ID of the page or media
198200 * @param string $summary the editing summary
199- * @throws SyncException
201+ * @throws SyncFileException
200202 */
201203 protected function syncPush ($ type , $ id , $ summary ) {
202204 if ($ type === self ::TYPE_PAGES ) {
@@ -217,7 +219,7 @@ protected function syncPush($type, $id, $summary) {
217219 * @param int $type pages|media
218220 * @param string $id the ID of the page or media
219221 * @param string $summary the editing summary
220- * @throws SyncException
222+ * @throws SyncFileException
221223 */
222224 protected function syncPushDelete ($ type , $ id , $ summary ) {
223225 if ($ type === self ::TYPE_PAGES ) {
@@ -234,7 +236,7 @@ protected function syncPushDelete($type, $id, $summary) {
234236 *
235237 * @param string $id
236238 * @param bool $state is this a lock (true) or unlock (false)
237- * @throws SyncException
239+ * @throws SyncFileException
238240 */
239241 protected function setRemoteLock ($ id , $ state ) {
240242 if ($ state ) {
@@ -248,7 +250,7 @@ protected function setRemoteLock($id, $state) {
248250 $ this ->client ->query ('dokuwiki.setLocks ' , array ('lock ' => $ lock , 'unlock ' => $ unlock ));
249251 $ data = $ this ->client ->getResponse ();
250252 if (count ((array ) $ data ['lockfail ' ])) {
251- throw new SyncException ( ' Locking at the remote wiki failed ' );
253+ throw new SyncFileException ( ' lockfail ' , $ id );
252254 }
253255 }
254256
0 commit comments