public function clear_destination($destination)
 {
     global $wp_filesystem;
     if (!is_dir($destination)) {
         // This is an installation not an upgrade.
         return parent::clear_destination($destination);
     }
     $data = $this->caj_get_plugin_data($destination);
     if (false === $data) {
         // The existing directory is not a valid plugin, skip backup.
         return parent::clear_destination($destination);
     }
     $backup_url = $this->caj_create_backup($destination);
     if (!is_wp_error($backup_url)) {
         /* translators: 1: plugin zip URL */
         $this->skin->feedback(sprintf(__('A backup zip file of the old plugin version can be downloaded <a href="%1$s">here</a>.', 'easy-theme-and-plugin-upgrades'), $backup_url));
         // Restore default strings and display the original remove_old message.
         $this->upgrade_strings();
         $this->skin->feedback('remove_old');
         return parent::clear_destination($destination);
     }
     $this->skin->error($backup_url);
     $this->skin->feedback(__('Moving the old version of the plugin to a new directory&#8230;', 'easy-theme-and-plugin-upgrades'));
     $new_name = basename($destination) . "-{$data['version']}";
     $directory = dirname($destination);
     for ($x = 0; $x < 20; $x++) {
         $test_name = $new_name . '-' . $this->get_random_characters(10, 20);
         if (!is_dir("{$directory}/{$test_name}")) {
             $new_name = $test_name;
             break;
         }
     }
     if (is_dir("{$directory}/{$new_name}")) {
         // We gave it our best effort. Time to give up on the idea of having a backup.
         $this->skin->error(__('Unable to find a new directory name to move the old version of the plugin to. No backup will be created.', 'easy-theme-and-plugin-upgrades'));
     } else {
         $result = $wp_filesystem->move($destination, "{$directory}/{$new_name}");
         if ($result) {
             /* translators: 1: new plugin directory name */
             $this->skin->feedback(sprintf(__('Moved the old version of the plugin to a new plugin directory named %1$s. This directory should be backed up and removed from the site.', 'easy-theme-and-plugin-upgrades'), "<code>{$new_name}</code>"));
         } else {
             $this->skin->error(__('Unable to move the old version of the plugin to a new directory. No backup will be created.', 'easy-theme-and-plugin-upgrades'));
         }
     }
     // Restore default strings and display the original remove_old message.
     $this->upgrade_strings();
     $this->skin->feedback('remove_old');
     return parent::clear_destination($destination);
 }