Приводит в порядок порядковые номера материалов раздела: удаляет дубликаты, дыры в нумерации.

@internal
@return void
609
public function fixMaterialTags() {
    	$r = self::getDbConnection()->fetchAll('SELECT count(tag) as cnt from '.$this->materialsTable.' where idcat='.$this->prototype->id.' group by tag having cnt>1');
    	if (!count($r)) return;
    	$i = 100;
    	$r = self::getDbConnection()->query('SELECT id FROM '.$this->materialsTable.' WHERE idcat='.$this->prototype->id.' ORDER BY tag');
    	while ($f = $r->fetch()) {
            self::getDbConnection()->executeQuery('UPDATE '.$this->materialsTable.' SET tag='.$i.' WHERE id='.$f['id']);
			$i = $i + 100;
		}
    }
242903
public function discard()
    {
        if ($this->isNew()) {
            $app = Facade::getFacadeApplication();
            $db = $app->make('database')->connection();
            // check for related version edits. This only gets applied when we edit global areas.
            $r = $db->executeQuery('select cRelationID, cvRelationID from CollectionVersionRelatedEdits where cID = ? and cvID = ?', array(
                $this->cID,
                $this->cvID,
            ));
            while ($row = $r->fetch()) {
                $cn = Page::getByID($row['cRelationID'], $row['cvRelationID']);
                $cnp = new Permissions($cn);
                if ($cnp->canApprovePageVersions()) {
                    $v = $cn->getVersionObject();
                    $v->delete();
                    $db->executeQuery('delete from CollectionVersionRelatedEdits where cID = ? and cvID = ? and cRelationID = ? and cvRelationID = ?', array(
                        $this->cID,
                        $this->cvID,
                        $row['cRelationID'],
                        $row['cvRelationID'],
                    ));
                }
            }
            $this->delete();
        }
        $this->refreshCache();
    }
1009034
public function delete()
    {
		        
		Event::trigger(EVENT_CORE_MATH_DELETE, ['material' => $this , 'message' => $this->getBoUrl()]);
		
        parent::delete();
        
        $this->updateCache();
    }
239207
protected function lightDelete()
     {
         $now = Time::current();
         $key = $this->getPKvalue();
         //
         $sql = 'update '.$this->DBtable." set deleted_at='".$now."' where ".$this->keyName." = '".$key."' ";
         if (Database::exec($sql)) {
             $this->clean();
             $this->deleted_at = $now;
         }
     }
434769
public function clear(): void
    {
        $this->value = null;
        $this->defaultValue = null;
        $this->lenght = -1;
        $this->type = MDataType::UNKNOWN;
        $this->name = null;
    }
237483
public function cmdUpdatePage()
    {
        $params = $this->getParam();

        if (empty($params[0]) || count($params) < 2) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (!is_numeric($params[0])) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $this->setSubmitted(null, $params);
        $this->setSubmitted('update', $params[0]);
        $this->validateComponent('page');

        $this->updatePage($params[0]);
        $this->output();
    }
144816
public function actionManage() 
	{
		$model=new OmmuTags('search');
		$model->unsetAttributes();	// clear any default values
		if(isset($_GET['OmmuTags'])) {
			$model->attributes=$_GET['OmmuTags'];
		}

		$columns = $model->getGridColumn($this->gridColumnTemp());

		$this->pageTitle = Yii::t('phrase', 'Global Tags');
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('/global_tag/admin_manage', array(
			'model'=>$model,
			'columns' => $columns,
		));
	}
166554
public function sortableAction()
    {
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        $request = $this->getRequest();

        /** @var EntityManager $em */
        $em = $this->getDoctrine()->getManager();

        $repository = $em->getRepository($admin->getClass());

        $object = $repository->find($request->request->get('id'));

        // Получаем позицию элемента, после которого должен стоять текущий

        $after_object = $repository->find($request->request->get('after_id'));

        $after_pos = 0;

        if ($after_object) {
            $after_pos = $after_object->getPosition();
        }

        $new_pos = 0;

        // Если позиция не определена, то 1, иначе + 1 от позиции после которого должен стоять.
        if ($after_object) {
            $new_pos = $after_pos + 1;
        }

        // Обновляем позиции текущего
        $object->setPosition($new_pos);

        $admin->update($object);

        return $this->renderJson(
            [
                'result' => 'ok',
                'objectId' => $admin->getNormalizedIdentifier($object),
            ]
        );
    }
542224
public function postDelete()
    {
        if ((!isset($this->revisionEnabled) || $this->revisionEnabled)
            && $this->isSoftDelete()
            && $this->isRevisionable($this->getDeletedAtColumn())) {
            $revisions[] = array(
                'revisionable_type' => $this->getMorphClass(),
                'revisionable_id' => $this->getKey(),
                'key' => $this->getDeletedAtColumn(),
                'old_value' => null,
                'new_value' => $this->{$this->getDeletedAtColumn()},
                'user_id' => $this->getSystemUserId(),
                'created_at' => new \DateTime(),
                'updated_at' => new \DateTime(),
            );
            $revision = static::newModel();
            \DB::table($revision->getTable())->insert($revisions);
        }
    }
1366503
public function delete()
    {
        $this->getContext()->invokeApiPost('DATABASES', [
            'action' => 'delete',
            'select0' => $this->getDatabaseName(),
        ]);
        $this->getContext()->getContextUser()->clearCache();
    }
282683
public function delete()
    {
        $this->remove_file();

        $connection = $this->getDataboxConnection();

        $connection->executeUpdate(
            'DELETE FROM permalinks WHERE subdef_id = :subdef_id',
            ['subdef_id' => $this->subdef_id]
        );

        self::getMediaSubdefRepository($this->app, $this->record->getDataboxId())->delete($this);
        $this->delete_data_from_cache();
        $this->record->delete_data_from_cache(record_adapter::CACHE_SUBDEFS);
    }
789979
public function clear(){
			$this->setFields('');
			$this->setSet('');
			$this->setLimit('');
			$this->setWhere('');
			$this->setOrderBy('');
			$this->setGroupBy('');
			$this->setRecords('');
			$this->setQuery('');
		}
31276
public function clear()
    {
        $this->id = null;
        $this->name = null;
        $this->street = null;
        $this->zip = null;
        $this->city = null;
        $this->country_id = null;
        $this->phone = null;
        $this->fax = null;
        $this->email = null;
        $this->legalform = null;
        $this->logo = null;
        $this->created = null;
        $this->notes = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->alreadyInClearAllReferencesDeep = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
309098
function delete ()
    {
        global $config;
        $query = sprintf(
            file_get_contents("sql/deletePage.sql"),
            mysql_real_escape_string($this->id)
        );
        $config->connexionBdd->requete($query);
    }
1351910
function onFormInitialized() {
		parent::onFormInitialized();
		$this->addClass('df-font'); // 2016-07-30 This CSS class will be applied to the <fieldset> DOM node.
		$this->checkbox(O::enabled, 'Setup?');
		$row1 = $this->fieldsetInline('df-checkboxes')->hide(); /** @var FInline $row1 */
		$row1->checkbox(O::bold, 'B', ['title' => 'Bold']);
		$row1->checkbox(O::italic, 'I', ['title' => 'Italic']);
		$row1->checkbox(O::underline, 'U', ['title' => 'Underline']);
		$row1->color(O::color, null, ['title' => 'Font Color']);
		$row2 = $this->fieldsetInline('df-family')->hide(); /** @var FInline $row2 */
		$row2->field(O::family, GoogleFont::class, null, ['title' => 'Font Family']);
		/** @var array(array(string => string)) $sizeValues */
		$sizeValues = [Q::P__VALUES => SizeUnit::s()->toOptionArray()];
		$row2->quantity(O::size, null, $sizeValues + ['title' => 'Font Size']);
		$row3 = $this->fieldsetInline('row3')->hide(); /** @var FInline $row3 */
		// 2015-12-13
		// Намеренно указываем в качестве подписи пустую строку, а не null,
		// чтобы получить пустые теги <label><span></span></label>
		// и потом стилизовать их своей иконкой.
		$row3->quantity(O::letter_spacing, '', $sizeValues + ['title' => 'Letter Spacing']);
		/**
		 * 2015-12-13
		 * Передаём в качестве подписи название класса Font Awesome.
		 * Такое стало возможным благодаря моему плагину
		 * @used-by \Df\Framework\Plugin\Data\Form\Element\AbstractElement::aroundGetLabelHtml()
		 * https://github.com/mage2pro/core/tree/73bed4fbb751ab47ad1bb70a8d90f455da26b500/Framework/Data/Form/Element/AbstractElementPlugin.php#L53
		 */
		/**
		 * 2015-12-13
		 *	.test {
		 *		transform : scale(1,1.5);
		 *		-webkit-transform:scale(1,1.5); // Safari and Chrome
		 *		-moz-transform:scale(1,1.5); // Firefox
		 *		-ms-transform:scale(1,1.5); // IE 9+
		 *		-o-transform:scale(1,1.5); // Opera
		 *		letter-spacing: 10px;
		 *	}
		 * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function#scale()
		 * http://stackoverflow.com/a/16447826
		 */
		$row3->percent(O::scale_horizontal, 'fa-text-width', 100, ['title' => 'Horizontal Scale']);
		$row3->percent(O::scale_vertical, 'fa-text-height', 100, ['title' => 'Vertical Scale']);
		/**
		 * 2015-12-13
		 * Намеренно указываем в качестве подписи пустую строку, а не null,
		 * чтобы получить пустые теги <label><span></span></label>
		 * и потом стилизовать их своей иконкой.
		 */
		df_hide($this->select(O::letter_case, '', LetterCase::s(), ['title' => 'Letter Case']));
		df_fe_init($this, __CLASS__, df_fa());
	}
533195
public function clear()
    {
        $this->identityMap =
        $this->documentIds =
        $this->documentState =
        $this->documentTranslations =
        $this->documentLocales =
        $this->nonMappedData =
        $this->originalData =
        $this->originalTranslatedData =
        $this->documentChangesets =
        $this->changesetComputed =
        $this->scheduledUpdates =
        $this->scheduledInserts =
        $this->scheduledMoves =
        $this->scheduledReorders =
        $this->scheduledRemovals =
        $this->visitedCollections =
        $this->documentHistory =
        $this->documentVersion = [];

        $this->invokeGlobalEvent(Event::onClear, new OnClearEventArgs($this->dm));

        $this->session->refresh(false);
    }
42145
public function change()
    {
        $table = $this->table('notices');
        $table->addColumn('author', 'string', array('limit' => 16))
              ->addColumn('text', 'integer')
              ->addColumn('start_time', 'datetime')
              ->addColumn('end_time', 'datetime')
              ->addColumn('hidden', 'boolean', array('null' => false, 'default' => 0))
              ->addColumn('frontpage', 'boolean', array('null' => false, 'default' => 1))
              ->addColumn('sort_order', 'integer')
              ->create();

        $table->addForeignKey('text', 'text_story', 'id', array('delete'=> 'CASCADE', 'update'=> 'CASCADE'))
              ->addForeignKey('author', 'user', 'user', array('delete'=> 'CASCADE', 'update'=> 'CASCADE'))
              ->save();

    }