Deleted config file handler.

        Simply fires the on_delete callback with the name of the deleted item.
502234
def on_deleted(self, event):
        
        logger.debug("file removed: %s", event.src_path)
        name = self.file_name(event)

        self.on_delete(self.target_class, name)
734480
public function afterDelete()
    {
        foreach ($this->getAllFields() as $field) {
            $path = $this->getFilePath($field, '');
            if (file_exists($path) && is_dir($path)) {
                FileHelper::removeDirectory($path);
            }
        }
    }
543707
def _get_deleted_fs(name, blade):
    '''
    
    '''
    try:
        _fs = _get_fs(name, blade)
        if _fs and _fs.destroyed:
            return _fs
    except rest.ApiException:
        return None
1128115
def do_remove(config, config_dir):
    
    if not os.path.exists(config_dir):
        print "Configuration '{}' does not exist.".format(config)
        exit(1)
    if confirm("Confirm removal of the configuration '{}'".format(config)):
        shutil.rmtree(config_dir)
        print "Configuration '{}' has been removed.".format(config)
    else:
        print "Removal cancelled."
766989
def deleted(self):
        ''
        _d = self.folder.attrib.get('deleted', None)
        if _d is None: return None
        return dateutil.parser.parse(str(_d))
581772
def delete(context, item):
    
    history_log = context.obj['history_log']
    no_color = context.obj['no_color']
    try:
        with open(history_log, 'r+') as f:
            lines = f.readlines()
            history = lines.pop(len(lines) - item)
            f.seek(0)
            f.write(''.join(lines))
            f.flush()
            f.truncate()
    except IndexError:
        echo_style(
            'History result at index %s does not exist.' % item,
            no_color,
            fg='red'
        )
        sys.exit(1)
    except Exception as error:
        echo_style(
            'Unable to delete result item {0}. {1}'.format(item, error),
            no_color,
            fg='red'
        )
        sys.exit(1)

    log_file = get_log_file_from_item(history)
    try:
        os.remove(log_file)
    except Exception:
        echo_style(
            'Unable to delete results file for item {0}.'.format(item),
            no_color,
            fg='red'
        )

    try:
        os.remove(log_file.rsplit('.', 1)[0] + '.results')
    except Exception:
        echo_style(
            'Unable to delete log file for item {0}.'.format(item),
            no_color,
            fg='red'
        )
1166089
def remove_file_no_raise(file_name, config):
    """"""
    # The removal can be disabled by the config for debugging purposes.
    if config.keep_xml:
        return True

    try:
        if os.path.exists(file_name):
            os.remove(file_name)
    except IOError as error:
        loggers.root.error(
            "Error occurred while removing temporary created file('%s'): %s",
            file_name, str(error))
1346055
def create_deletion_handler(preference):
    
    def delete_related_preferences(sender, instance, *args, **kwargs):
        queryset = preference.registry.preference_model.objects\
                                      .filter(name=preference.name,
                                              section=preference.section)
        related_preferences = queryset.filter(
            raw_value=preference.serializer.serialize(instance))
        related_preferences.delete()
    return delete_related_preferences
1150261
public function onDeleteItem()
    {
        $this->abortIfReadOnly();

        $paths = Input::get('paths');

        if (!is_array($paths)) {
            throw new ApplicationException('Invalid input data');
        }

        $library = MediaLibrary::instance();

        $filesToDelete = [];
        foreach ($paths as $pathInfo) {
            $path = array_get($pathInfo, 'path');
            $type = array_get($pathInfo, 'type');

            if (!$path || !$type) {
                throw new ApplicationException('Invalid input data');
            }

            if ($type === MediaLibraryItem::TYPE_FILE) {
                /*
                 * Add to bulk collection
                 */
                $filesToDelete[] = $path;
            }
            elseif ($type === MediaLibraryItem::TYPE_FOLDER) {
                /*
                 * Delete single folder
                 */
                $library->deleteFolder($path);

                /**
                 * @event media.folder.delete
                 * Called after a folder is deleted
                 *
                 * Example usage:
                 *
                 *     Event::listen('media.folder.delete', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path) {
                 *         \Log::info($path . " was deleted");
                 *     });
                 *
                 * Or
                 *
                 *     $mediaWidget->bindEvent('folder.delete', function ((string) $path) {
                 *         \Log::info($path . " was deleted");
                 *     });
                 *
                 */
                $this->fireSystemEvent('media.folder.delete', [$path]);
            }
        }

        if (count($filesToDelete) > 0) {
            /*
             * Delete collection of files
             */
            $library->deleteFiles($filesToDelete);

            /*
             * Extensibility
             */
            foreach ($filesToDelete as $path) {
                /**
                 * @event media.file.delete
                 * Called after a file is deleted
                 *
                 * Example usage:
                 *
                 *     Event::listen('media.file.delete', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path) {
                 *         \Log::info($path . " was deleted");
                 *     });
                 *
                 * Or
                 *
                 *     $mediaWidget->bindEvent('file.delete', function ((string) $path) {
                 *         \Log::info($path . " was deleted");
                 *     });
                 *
                 */
                $this->fireSystemEvent('media.file.delete', [$path]);
            }
        }

        $library->resetCache();
        $this->prepareVars();

        return [
            '#'.$this->getId('item-list') => $this->makePartial('item-list')
        ];
    }
1230786
def actually_toggle_deleted t
    if t.has_label? :deleted
      t.remove_label :deleted
      add_or_unhide t.first
      UpdateManager.relay self, :undeleted, t.first
      lambda do
        t.apply_label :deleted
        hide_thread t
        UpdateManager.relay self, :deleted, t.first
      end
    else
      t.apply_label :deleted
      hide_thread t
      UpdateManager.relay self, :deleted, t.first
      lambda do
        t.remove_label :deleted
        add_or_unhide t.first
        UpdateManager.relay self, :undeleted, t.first
      end
    end
  end
495376
def _deregister_config_file(self, key):
        
        state = self.__load_state()
        if 'remove_configs' not in state:
            state['remove_configs'] = {}
        state['remove_configs'][key] = (state['config_files'].pop(key))
        self.__dump_state(state)
1285538
function handleFileDelete() {
        var entry = ProjectManager.getSelectedItem();
        Dialogs.showModalDialog(
            DefaultDialogs.DIALOG_ID_EXT_DELETED,
            Strings.CONFIRM_DELETE_TITLE,
            StringUtils.format(
                entry.isFile ? Strings.CONFIRM_FILE_DELETE : Strings.CONFIRM_FOLDER_DELETE,
                StringUtils.breakableUrl(entry.name)
            ),
            [
                {
                    className : Dialogs.DIALOG_BTN_CLASS_NORMAL,
                    id        : Dialogs.DIALOG_BTN_CANCEL,
                    text      : Strings.CANCEL
                },
                {
                    className : Dialogs.DIALOG_BTN_CLASS_PRIMARY,
                    id        : Dialogs.DIALOG_BTN_OK,
                    text      : Strings.DELETE
                }
            ]
        )
            .done(function (id) {
                if (id === Dialogs.DIALOG_BTN_OK) {
                    ProjectManager.deleteItem(entry);
                }
            });
    }
68436
def cleanup_on_delete(self, sender, document, **kwargs):
        '''
        
        '''
        if not self.follow or sender is not self.owner_document:
            return
        slug = getattr(document, self.db_field)
        namespace = self.owner_document.__name__
        SlugFollow.objects(namespace=namespace, new_slug=slug).delete()
338620
def do_delete_config(self, line):
        

        def f(p, args):
            try:
                source = args[0]
            except:
                print("argument error")
                return
            print(p.delete_config(source))

        self._request(line, f)
42608
function onImageFileSent(file, config) {
    if (config.cleanupRuntime) {
        fs.unlink(file, () => logger.debug('Deleted file: %s', file));
    }
}
381536
def on_balancer_remove(self, name):
        
        if len(self.configurables[Balancer]) == 1:
            logger.critical(
                "'%s' config file removed! It was the only balancer left!",
                name
            )
127880
def trigger_deleted(self, filepath):
        """"""
        if not os.path.exists(filepath):
            self._trigger('deleted', filepath)