Deleting a site

Hi,

I created a site just as a test besides our main site, but I can’t delete it in the administration page, it returns an error page… Has anybody encountered the same issue ?

Thank you for your help

A.

Please copy and paste the error message which you get when you try to delete the site here as a comment.

Hello @mebrett, it just says " Omeka S Encountered an Error " whenever I try to delete the website from the graphic backend of our omeka S. Is there another way to delete a site ?

You can turn on error logging and robust error messages to get more information about what’s happening.

Did you find a solution for this? I’m also experiencing this error…

Are you getting the generic error? If you turn on robust error messages, what does it say?

Just turned on those options, and this is the detailed error:

Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException
An exception occurred while executing ‘DELETE FROM site WHERE id = ?’ with params [6]: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (ocomedu_os1.site_page, CONSTRAINT FK_2F900BD9F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id))

Details:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (ocomedu_os1.site_page, CONSTRAINT FK_2F900BD9F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)) in /home/ocomedu/odc.ocom.edu/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105 Stack trace:

Let me know if you’d like to see the entire log.

I’m not really sure why that’s happening (and can’t reproduce it) but you should be able to work around the issue by just going into the site’s Pages admin screen and deleting all the pages, then deleting the site.

Just a me-too post from me. @jflatnes workaround worked around for me, but it would be nice to have it not be needed.

Details:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`our_db`.`site_page`, CONSTRAINT `FK_2F900BD9F6BD1646` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`)) in /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105
Stack trace:
#0 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)
#1 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1006): Doctrine\DBAL\Driver\PDOStatement->execute()
#2 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(596): Doctrine\DBAL\Connection->executeUpdate('DELETE FROM sit...', Array, Array)
#3 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(580): Doctrine\DBAL\Connection->delete('site', Array, Array)
#4 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1094): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->delete(Object(Omeka\Entity\Site))
#5 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(406): Doctrine\ORM\UnitOfWork->executeDeletions(Object(Doctrine\ORM\Mapping\ClassMetadata))
#6 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(356): Doctrine\ORM\UnitOfWork->commit(NULL)
#7 /path/to/application/src/Api/Adapter/AbstractEntityAdapter.php(425): Doctrine\ORM\EntityManager->flush()
#8 /path/to/application/src/Api/Manager.php(239): Omeka\Api\Adapter\AbstractEntityAdapter->delete(Object(Omeka\Api\Request))
#9 /path/to/application/src/Api/Manager.php(164): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#10 /path/to/application/src/Mvc/Controller/Plugin/Api.php(189): Omeka\Api\Manager->delete('sites', Array, Array, Array)
#11 /path/to/application/src/Controller/SiteAdmin/IndexController.php(416): Omeka\Mvc\Controller\Plugin\Api->delete('sites', Array)
#12 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Omeka\Controller\SiteAdmin\IndexController->deleteAction()
#13 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#14 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#16 /path/to/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#17 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#18 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#19 /path/to/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#20 /path/to/index.php(21): Zend\Mvc\Application->run()
#21 {main}

Next Doctrine\DBAL\Driver\PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`our_db`.`site_page`, CONSTRAINT `FK_2F900BD9F6BD1646` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`)) in /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107
Stack trace:
#0 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1006): Doctrine\DBAL\Driver\PDOStatement->execute()
#1 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(596): Doctrine\DBAL\Connection->executeUpdate('DELETE FROM sit...', Array, Array)
#2 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(580): Doctrine\DBAL\Connection->delete('site', Array, Array)
#3 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1094): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->delete(Object(Omeka\Entity\Site))
#4 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(406): Doctrine\ORM\UnitOfWork->executeDeletions(Object(Doctrine\ORM\Mapping\ClassMetadata))
#5 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(356): Doctrine\ORM\UnitOfWork->commit(NULL)
#6 /path/to/application/src/Api/Adapter/AbstractEntityAdapter.php(425): Doctrine\ORM\EntityManager->flush()
#7 /path/to/application/src/Api/Manager.php(239): Omeka\Api\Adapter\AbstractEntityAdapter->delete(Object(Omeka\Api\Request))
#8 /path/to/application/src/Api/Manager.php(164): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#9 /path/to/application/src/Mvc/Controller/Plugin/Api.php(189): Omeka\Api\Manager->delete('sites', Array, Array, Array)
#10 /path/to/application/src/Controller/SiteAdmin/IndexController.php(416): Omeka\Mvc\Controller\Plugin\Api->delete('sites', Array)
#11 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Omeka\Controller\SiteAdmin\IndexController->deleteAction()
#12 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#13 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#15 /path/to/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#16 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#17 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 /path/to/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#19 /path/to/index.php(21): Zend\Mvc\Application->run()
#20 {main}

Next Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: An exception occurred while executing 'DELETE FROM site WHERE id = ?' with params [4]:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`our_db`.`site_page`, CONSTRAINT `FK_2F900BD9F6BD1646` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`)) in /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:60
Stack trace:
#0 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(128): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1015): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'DELETE FROM sit...', Array)
#2 /path/to/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(596): Doctrine\DBAL\Connection->executeUpdate('DELETE FROM sit...', Array, Array)
#3 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(580): Doctrine\DBAL\Connection->delete('site', Array, Array)
#4 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1094): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->delete(Object(Omeka\Entity\Site))
#5 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(406): Doctrine\ORM\UnitOfWork->executeDeletions(Object(Doctrine\ORM\Mapping\ClassMetadata))
#6 /path/to/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(356): Doctrine\ORM\UnitOfWork->commit(NULL)
#7 /path/to/application/src/Api/Adapter/AbstractEntityAdapter.php(425): Doctrine\ORM\EntityManager->flush()
#8 /path/to/application/src/Api/Manager.php(239): Omeka\Api\Adapter\AbstractEntityAdapter->delete(Object(Omeka\Api\Request))
#9 /path/to/application/src/Api/Manager.php(164): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#10 /path/to/application/src/Mvc/Controller/Plugin/Api.php(189): Omeka\Api\Manager->delete('sites', Array, Array, Array)
#11 /path/to/application/src/Controller/SiteAdmin/IndexController.php(416): Omeka\Mvc\Controller\Plugin\Api->delete('sites', Array)
#12 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Omeka\Controller\SiteAdmin\IndexController->deleteAction()
#13 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#14 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /path/to/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#16 /path/to/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#17 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#18 /path/to/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#19 /path/to/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#20 /path/to/index.php(21): Zend\Mvc\Application->run()
#21 {main}

What version of Omeka S is this?

The fundamental problem from our end is that we can’t reproduce this error. Any additional information could potentially be helpful (does this happen with all sites or just some, does it matter what the role of the user is, just general system information, etc.)

  • Version: 1.4.0; I’m having it on two separate instances (one Reclaim hosted, one CDS hosted). I’ll upgrade the one I can and see whether it happens on 2.0.2
  • Happening on all sites, as far as I can tell. One instance I don’t have the authority to test on rando sites, but any new site I create gets this error when I try to delete it, even if I haven’t done anything past the creation steps.
  • User role: AFAIK, you can only have the delete option if you are Global Admin or Site Admin, and it does happen for both of those roles

Totally understand the need to be able to replicate the error, and I’m happy to keep trying what I can on my end to help the team get there.

The functionality that’s supposed to be happening here (automatically deleting the pages when the site is deleted) is provided by Doctrine, S’s database component. Version 2 includes a significant update to the Doctrine libraries so it’s certainly possible that 2.0 fixes the issue (though to my knowledge we haven’t actually seen it occur personally on any version).

Updated the instance that I could to 2.0.2, and the deletion functionality is working for me now.

OK, well that’s definitely useful information, thanks.

A fixed bug in Doctrine is looking like the most likely scenario here, then.

1 Like