Answers.Body: <p>Deleting a site in WP triggers deleting sites/nn/uploads folder contents. Unfortunately, that site still had a civicrm symlink pointing to /uploads/civicrm which the delete trigger followed and subsequently deleted. </p>
  
  <p>Don't use symlinks. I removed without issue. Instead you can define resource paths in civicrm.settings.php file. Will take a look at updating docs.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-24T02:03:30.407Z
Answers.LastActivityDate: 2020-04-24T11:40:35.537Z
Answers.LastEditDate: 2020-04-24T11:40:35.537Z
Answers.UserDisplayName: Andy Burns
Body: <p>Similar to the behavior of this <a href="https://civicrm.stackexchange.com/questions/27761/upgrading-wp-to-5-0-1-deletes-civicrm-uploads-folder">Upgrading WP to 5.0.1 deletes civicrm uploads folder</a>, I had deactivated then decided to delete a site on our WP multisite. Once I clicked delete I got a fatal error (sorry I did not copy) that referenced line 916 of civicrm.php file. Deactivating CiviCRM plugin got the multisite backup.</p>
  
  <pre><code>require_once 'CRM/Core/ClassLoader.php';
        CRM_Core_ClassLoader::singleton()-&gt;register();
  </code></pre>
  
  <p>Then I saw that the uploads/civicrm folder was empty. It had the <em>/ext /uploads and /template_c</em> folder but they were all empty. The rest were gone.</p>
  
  <p>We restored the directory from backup and now it works. Anyways, this is a word of caution.</p>
  
  <p>Question is, why did this happen?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-16T17:30:33.257Z
Comments.Text: was the `/uploads/sites/` folder somehow symlinked to `/uploads/civicrm` ?
Comments.UserDisplayName: Kevin Cristiano
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-16T17:44:06.747Z
Comments.Text: Yes,symlinks are still in /uploads/sites/XX. Those symlinks should be removed, right?
Comments.UserDisplayName: Andy Burns
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-17T20:13:53.387Z
Comments.Text: I'd test it first, but Yes, I think the symlinks are the issue.  If WP follows the link when deleting the site it will remove files it should not.    This does bring up a point that we should ensure the documentation is correct on docs.civicrm.org as well.
Comments.UserDisplayName: Kevin Cristiano
Tags: <wordpress><multisite>
Title: Deleting a site on WP multisite deletes civicrm uploads folder's contents
ThreadText: # Deleting a site on WP multisite deletes civicrm uploads folder's contents
  
  (Asked by: username_0 on 2020-04-16)
  
  Similar to the behavior of this [Upgrading WP to 5.0.1 deletes civicrm uploads folder](https://civicrm.stackexchange.com/questions/27761/upgrading-wp-to-5-0-1-deletes-civicrm-uploads-folder), I had deactivated then decided to delete a site on our WP multisite. Once I clicked delete I got a fatal error (sorry I did not copy) that referenced line 916 of civicrm.php file. Deactivating CiviCRM plugin got the multisite backup.
  
  ```
  require_once 'CRM/Core/ClassLoader.php';
        CRM_Core_ClassLoader::singleton()->register();
  
  ```
  
  Then I saw that the uploads/civicrm folder was empty. It had the */ext /uploads and /template\_c* folder but they were all empty. The rest were gone.
  
  We restored the directory from backup and now it works. Anyways, this is a word of caution.
  
  Question is, why did this happen?
  
  **Tags:** wordpress, multisite
  
  > **Comments:**
  > **username_1**: was the `/uploads/sites/` folder somehow symlinked to `/uploads/civicrm` ?  
  > **username_0**: Yes,symlinks are still in /uploads/sites/XX. Those symlinks should be removed, right?  
  > **username_1**: I'd test it first, but Yes, I think the symlinks are the issue.  If WP follows the link when deleting the site it will remove files it should not.    This does bring up a point that we should ensure the documentation is correct on docs.civicrm.org as well.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-04-24. Score: 1 | Accepted answer
  
  Deleting a site in WP triggers deleting sites/nn/uploads folder contents. Unfortunately, that site still had a civicrm symlink pointing to /uploads/civicrm which the delete trigger followed and subsequently deleted.
  
  Don't use symlinks. I removed without issue. Instead you can define resource paths in civicrm.settings.php file. Will take a look at updating docs.
  
  
  ---
  
  