• Welcome to Simple Machines Community Forum. Please login or sign up.

Attachments directory gone after upgrading

Started by aED, June 17, 2020, 10:51:43 AM

Previous topic - Next topic

aED

June 17, 2020, 10:51:43 AM Last Edit: June 17, 2020, 11:14:39 AM by aED
I just updated my forum today using the large upgrade. From 2.0RC something to 2.0.17. (Yeah it was a pretty old version but the forum was offline for a few months and I only had the time to put it back online today)

After update the multiple attachments path on the admin section is empty. Before the upgrade I have set multiple attachment paths.


I downloaded repair_settings.php and its only showing a:29:{i:1;s:21: on the attachment directory section.


I checked the database and saw that the "attachmentUploadDir" contains a:29:{i:1;s:21:"/path/to/1";i:2;s:21:"/path/to/2";i:3;s:21:"/path/to/3";i:4;s:21:"/path/to/4";i:5;s:21:"/path/to/5";i:6;s:21:"/path/to/6";i:7;s:21:"/path/to/7";i:8;s:21:"/path/to/8";i:9;s:21:"/path/to/9";i:10;s:22:"/path/to/10";i:11;s:22:"/path/to/11";i:12;s:22:"/path/to/12";i:13;s:22:"/path/to/13";i:14;s:22:"/path/to/14";i:15;s:22:"/path/to/15";i:16;s:22:"/path/to/16";i:17;s:22:"/path/to/17";i:18;s:22:"/path/to/18";i:19;s:22:"/path/to/19";i:20;s:22:"/path/to/20";i:21;s:22:"/path/to/21";i:22;s:22:"/path/to/22";i:23;s:22:"/path/to/23";i:24;s:22:"/path/to/24";i:25;s:22:"/path/to/25";i:26;s:22:"/path/to/26";i:27;s:22:"/path/to/27";i:28;s:22:"/path/to/28";i:29;s:22:"/path/to/29";}

How can I fix this?  BTW I also moved to a new server so the paths have changed if that matters. But I think the set attachment dirs shouldnt disappear even if the directories they point to doesnt exist.

Arantor

repair_settings apparently mangles multiple attachment folders.

Take off the first and last quotes from the longer string you have there.
No good deed goes unpunished
All helpful urges should be circumvented

aED

Quote from: Arantor on June 17, 2020, 11:04:27 AM
repair_settings apparently mangles multiple attachment folders.

Take off the first and last quotes from the longer string you have there.
There is no quotes on the database I must have added them when I posted them here. I updated my first post and remove the first and last quote.

Arantor

Except that the truncation is consistent with ending at the first quote after the ones that shouldn't have been there. And repair_settings is known to have issues with this.
No good deed goes unpunished
All helpful urges should be circumvented

aED

Quote from: Arantor on June 17, 2020, 11:18:24 AM
Except that the truncation is consistent with ending at the first quote after the ones that shouldn%u2019t have been there.
Sorry did not understand this. So what again should I do on the strings above?


Well let me review the code and see how it parses that string :)

Arantor

Well, the code goes looking for a string, finds a thing that doesn't immediately look like an array definition (since it doesn't start with a:), because it had a quote mark, and then simply went until the next quote mark.

This is why I'm a bit skeptical of 'it doesn't have quote marks there' when that's the most likely way for it to fail.
No good deed goes unpunished
All helpful urges should be circumvented

shawnb61

You can re-enter the paths in the Admin Control Panel, under Admin | Forum | Attachment Settings, by the setting for Attachment Directory you will see a link for managing multiple directories.  You can add them properly by hand here.  Note the order is very important - it must match your current order.  (Save off the old entry for attachmentUploadDir beforehand to be safe.)


There have been some reports here & there of issues with multiple attachment directories, with both repair_settings & the upgrader. 

But...  I have never been able to reproduce them...  A multiple attachment folder config works just fine in repair_settings & during upgrades in all my tests.

But I wonder if there is something about that particular string?  (Maybe something quirky about early 2.0.x serialized strings?)

Would it be possible to share the complete string here (folder names obfuscated)?  If not, feel free to PM the string to me & I'll take a peek.  That might help us with a longer-term fix.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

aED

June 17, 2020, 09:27:56 PM #7 Last Edit: June 17, 2020, 09:48:27 PM by aED
Quote from: Arantor on June 17, 2020, 12:36:29 PM
Well, the code goes looking for a string, finds a thing that doesn't immediately look like an array definition (since it doesn't start with a:), because it had a quote mark, and then simply went until the next quote mark.

This is why I'm a bit skeptical of 'it doesn't have quote marks there' when that's the most likely way for it to fail.
Like I said there was no quote mark on the database. I added them when I pasted them here (Its like a reflex for me when I paste something that I want to quote). And I also edited the entry on the database just to be sure there was no quote marks and it is still not showing the list of directories on the attachment settings. I also think the repair_settings.php did not have any effect  into this because there is no save button on it when I tried it. I just uploaded it to the server and then just saw that it was not displaying the values correctly I did not save anything or something using the repair_settings.php since there was no save or apply button to begin with.

I guess the save button should be at the bottom but its not there.

See no quotes there

Quote from: shawnb61 on June 17, 2020, 05:10:19 PM
You can re-enter the paths in the Admin Control Panel, under Admin | Forum | Attachment Settings, by the setting for Attachment Directory you will see a link for managing multiple directories.  You can add them properly by hand here.  Note the order is very important - it must match your current order.  (Save off the old entry for attachmentUploadDir beforehand to be safe.)


There have been some reports here & there of issues with multiple attachment directories, with both repair_settings & the upgrader. 

But...  I have never been able to reproduce them...  A multiple attachment folder config works just fine in repair_settings & during upgrades in all my tests.

But I wonder if there is something about that particular string?  (Maybe something quirky about early 2.0.x serialized strings?)

Would it be possible to share the complete string here (folder names obfuscated)?  If not, feel free to PM the string to me & I'll take a peek.  That might help us with a longer-term fix.


The complete string is on my first post I just replaced the directory with `/path/to`. I will try your suggestion.

aED

I found the problem now. So after I saw that SMF just uses serialize/unserialize I  tried to paste it into a PHP file and see if it can unserialize the string. And it cannot so there is something wrong with the string and I saw that the last entry has the ";" inside the quoted string. Just putting it after the quote fixed it.

The end of the string is like this
Quotei:29;s:26:"/path/to/dir/29;"}
instead of this
Quotei:29;s:26:"/path/to/dir/29";}


I don't know how it got there. Since all I did was restore our database from a backup file and then run the large upgrade script. After that I saw that attachment dirs were not showing. So somewhere between the import of database and the upgrade script changed it. I checked our backup db file and the data in there is correct since the semicolon is where it should be.

shawnb61

So you're saying the upgrade moved the semicolon from outside the string to inside?
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Kindred

Quote from: aED on June 17, 2020, 10:51:43 AM
a:29:{i:1;s:21:"/path/to/1";i:2;s:21:"/path/to/2";i:3;s:21:"/path/to/3";i:4;s:21:"/path/to/4";i:5;s:21:"/path/to/5";i:6;s:21:"/path/to/6";i:7;s:21:"/path/to/7";i:8;s:21:"/path/to/8";i:9;s:21:"/path/to/9";i:10;s:22:"/path/to/10";i:11;s:22:"/path/to/11";i:12;s:22:"/path/to/12";i:13;s:22:"/path/to/13";i:14;s:22:"/path/to/14";i:15;s:22:"/path/to/15";i:16;s:22:"/path/to/16";i:17;s:22:"/path/to/17";i:18;s:22:"/path/to/18";i:19;s:22:"/path/to/19";i:20;s:22:"/path/to/20";i:21;s:22:"/path/to/21";i:22;s:22:"/path/to/22";i:23;s:22:"/path/to/23";i:24;s:22:"/path/to/24";i:25;s:22:"/path/to/25";i:26;s:22:"/path/to/26";i:27;s:22:"/path/to/27";i:28;s:22:"/path/to/28";i:29;s:22:"/path/to/29";}

no... in the original post, the semicolon is in the correct spot.


however -- I **ASSUME** that you have changed the displayed paths in your post?  because s:21 and s:22 do not make any sense with the content you posted
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

shawnb61

Correct.  OP didn't change the lengths when obfuscating the paths.

The question is how the semicolon was moved.  I cannot replicate, either with repair_settings or the upgrader. 

OP notes that version above is from backup. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: