Commit 3ba39a90 authored by ~rs's avatar ~rs

edit different pages at the same time

parent ca025b68
Pipeline #1927 failed with stages
in 47 seconds
p
#!/usr/bin/php
<?php
require './Core/BotCore.php';
# commented out: show diff before saving
......@@ -15,6 +15,7 @@ class EditInEditor extends Core {
$this->$Job = $Job;
$this->$pUseHTTPS = $pUseHTTPS;
$this->$botflag = $botflag;
$this->$counter = 0;
}
public function login($Account = $this->$Account, $Job = $this->$Job, $pUseHTTPS = $this->$pUseHTTPS, $botflag = $this->$botflag) {
......@@ -35,15 +36,23 @@ class EditInEditor extends Core {
}
public function edit($pagename) {
$this->$pagename = $pagename;
$this->$pagecontent = $this->readPage($pagename);
if ($this->$pagename) {
if ($this->$pagename[$this->$counter]!==$pagename) {
$this->$counter++;
$this->$pagename[$this->$counter] = $pagename;
}
} else {
$this->$pagename[$this->$counter] = $pagename;
}
$this->$pagecontent[$counter] = $this->readPage($pagename);
//create temporary file to edit
$page_tmp = tempnam(__DIR__, '.tmp_EiE_');
fwrite(fopen($page_tmp, 'a+'), $this->$pagecontent);
fwrite(fopen($page_tmp, 'a+'), $this->$pagecontent[$counter]);
popen($this->$editor . ' ' . $page_tmp, "w");
$this->askOperator('Done?');
# $oldcontent = $pagecontent;
$this->$pagecontent = file_get_contents($page_tmp);
# $oldcontent[$counter] = $pagecontent[$counter];
$this->$pagecontent[$counter] = file_get_contents($page_tmp);
//delete temporary file
unlink($page_tmp);
}
......@@ -54,8 +63,8 @@ class EditInEditor extends Core {
echo $diff;
}
*/
public function save(bool $minor) {
$this->editPageD($this->$pagename, $this->$pagecontent, $this->$Job, $this->$botflag, $minor, 0, false);
public function save(bool $minor, $number = $this->$counter) {
$this->editPageD($this->$pagename[$number], $this->$pagecontent[$number], $this->$Job, $this->$botflag, $minor, 0, false);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment