Skip to content

Commit 9fc3699

Browse files
committed
Restore only additional plugins from the temporary copy.
1 parent 3b6e249 commit 9fc3699

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Provides an easy, automated, web-based update mechanism for phpList installation
44

55
### Usage
66

7-
The new phpList updater gives you an easy way to upgrade your installation via web. In four steps you can update your installation to the latest release.
7+
The new phpList updater gives you an easy way to upgrade your installation via web. In four steps you can update your installation to the latest release.
88

99
The Updater is available in phpList 3.3.7+.
1010

@@ -23,7 +23,7 @@ The updater is currently performing the following steps. If one of those steps f
2323
5. Ask the user if they want a backup of the software:
2424
- Yes: ask the user for the location
2525
- If no: continue to the next step.
26-
26+
2727
6. Download new version to a temporary folder
2828
7. Add maintenance mode
2929
8. Replace PHP entry points with "Update in progress" message
@@ -39,20 +39,20 @@ The updater is currently performing the following steps. If one of those steps f
3939

4040
### Permissions
4141

42-
The whole phpList directory and the files within it must be writable by the HTTP user under which your web server is running as.
43-
If there is no match between the owner of your phpList files and the user under which your web server is running, you won’t be able to update.
42+
The whole phpList directory and the files within it must be writable by the HTTP user under which your web server is running as.
43+
If there is no match between the owner of your phpList files and the user under which your web server is running, you won’t be able to update.
4444
The ownership can be changed in a Linux terminal using this command:
4545

4646
<pre> chown -R user:group /path/to/phpList-directory </pre>
4747

48-
For instance:
48+
For instance:
4949

5050
<pre> chown -R www-data:www-data /var/www/lists </pre>
5151

5252
Change directory and file permissions:
5353

54-
<pre> find . -type d -exec chmod 755 {} \; </pre>
55-
<pre> find . -type f -exec chmod 644 {} \; </pre>
54+
<pre> find . -type d -exec chmod 755 {} \; </pre>
55+
<pre> find . -type f -exec chmod 644 {} \; </pre>
5656

5757
Permissions vary from host to host. To find the HTTP user check the Apache Server configuration files.
5858
You can view a file's ownership, permissions, and other important information with the ls command, using the -la option:
@@ -75,19 +75,19 @@ After a successful update, please consider to re-apply any hardened directory pe
7575
The updater is at the moment solely focused on replacing the files of the core installation. It does neither:
7676

7777
- Upgrade the database (this uses the existing database migration code)
78-
- Upgrade the plugins (this uses the existing plugin updater)
7978

8079
### Notes
8180

8281
- The updater stops when it finds unexpected files (not from phpList default installation) and lists them. To continue, you should delete these files or move them outside lists directory.
8382
- It is possible to override the backup checks by reloading the page when the backup check fails. Do not reload the page unless you wish to proceed without a backup in this case.
8483
- When the update process fails you should manually remove actions.txt file inside the config folder in order to reset the process and be able to try again.
8584
- The config directory is required to be writable because the "current step" of the automatic updater is saved inside it.
85+
- The plugins that are now included with phplist will be upgraded as part of the update. Any additional plugins will be kept but not upgraded.
8686

8787
### Future development plans
8888

8989
At the moment only our current stable release, phpList 3, is supported by the updater. We’ll work on adding support to our upcoming phpList 4 release.
9090

91-
### Report bugs and improvements:
91+
### Report bugs and improvements:
9292
https://mantis.phplist.org/set_project.php?project_id=2;185
9393

index.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,17 +737,24 @@ function movePluginsInTempFolder()
737737
}
738738

739739
/**
740-
* Move plugins back in admin directory.
740+
* Move any additional plugin files and directories back to the admin directory.
741741
* @throws UpdateException
742742
*/
743743
function movePluginsInPlace()
744744
{
745745
$oldDir = realpath(__DIR__ . '/../tmp_uploaded_update/tempplugins');
746746
$newDir = realpath(__DIR__ . '/../admin/plugins');
747-
$this->rmdir_recursive($newDir);
748-
$state = rename($oldDir, $newDir);
749-
if ($state === false) {
750-
throw new UpdateException("Could not move plugins directory to admin folder.");
747+
748+
$existingPluginFiles = scandir($oldDir);
749+
$newPluginFiles = scandir($newDir);
750+
$additional = array_diff($existingPluginFiles, $newPluginFiles);
751+
752+
foreach ($additional as $file) {
753+
$state = rename("$oldDir/$file", "$newDir/$file");
754+
755+
if ($state === false) {
756+
throw new UpdateException("Could not restore plugin $file.");
757+
}
751758
}
752759
}
753760

0 commit comments

Comments
 (0)