Page MenuHomePhabricator

D12885.id31040.diff
No OneTemporary

D12885.id31040.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -36,7 +36,6 @@
'AphrontSchemaQueryException' => 'aphront/storage/exception/AphrontSchemaQueryException.php',
'AphrontScopedUnguardedWriteCapability' => 'aphront/writeguard/AphrontScopedUnguardedWriteCapability.php',
'AphrontWriteGuard' => 'aphront/writeguard/AphrontWriteGuard.php',
- 'AphrontWriteGuardExitEventListener' => 'aphront/writeguard/event/AphrontWriteGuardExitEventListener.php',
'BaseHTTPFuture' => 'future/http/BaseHTTPFuture.php',
'CommandException' => 'future/exec/CommandException.php',
'ConduitClient' => 'conduit/ConduitClient.php',
@@ -411,7 +410,6 @@
'phutil_escape_html_newlines' => 'markup/render.php',
'phutil_escape_uri' => 'markup/render.php',
'phutil_escape_uri_path_component' => 'markup/render.php',
- 'phutil_exit' => 'utils/utils.php',
'phutil_fnmatch' => 'utils/utils.php',
'phutil_format_bytes' => 'utils/viewutils.php',
'phutil_format_relative_time' => 'utils/viewutils.php',
@@ -505,7 +503,6 @@
'AphrontQueryException' => 'Exception',
'AphrontRecoverableQueryException' => 'AphrontQueryException',
'AphrontSchemaQueryException' => 'AphrontQueryException',
- 'AphrontWriteGuardExitEventListener' => 'PhutilEventListener',
'BaseHTTPFuture' => 'Future',
'CommandException' => 'Exception',
'ConduitClientException' => 'Exception',
diff --git a/src/aphront/writeguard/AphrontWriteGuard.php b/src/aphront/writeguard/AphrontWriteGuard.php
--- a/src/aphront/writeguard/AphrontWriteGuard.php
+++ b/src/aphront/writeguard/AphrontWriteGuard.php
@@ -32,7 +32,6 @@
private static $instance;
private static $allowUnguardedWrites = false;
- private static $abruptExitlistenerIsInstalled = false;
private $callback;
private $allowDepth = 0;
@@ -78,11 +77,6 @@
'indicates a serious error.',
__CLASS__));
}
- if (!self::$abruptExitlistenerIsInstalled) {
- self::$abruptExitlistenerIsInstalled = true;
- $event_listener = new AphrontWriteGuardExitEventListener();
- $event_listener->register();
- }
$this->callback = $callback;
self::$instance = $this;
}
@@ -112,16 +106,6 @@
self::$instance = null;
}
- /**
- * This is used for clearing the write guard without performing any checks.
- * This is used in conjunction with phutil_exit for abrupt exits.
- *
- * @return void
- */
- public function disposeAbruptly() {
- self::$instance = null;
- }
-
/**
* Determine if there is an active write guard.
diff --git a/src/aphront/writeguard/event/AphrontWriteGuardExitEventListener.php b/src/aphront/writeguard/event/AphrontWriteGuardExitEventListener.php
deleted file mode 100644
--- a/src/aphront/writeguard/event/AphrontWriteGuardExitEventListener.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Listener for "will exit abruptly" events. Shuts down the attached write guard
- * before request exits.
- */
-final class AphrontWriteGuardExitEventListener extends PhutilEventListener {
-
- public function register() {
- $this->listen(PhutilEventType::TYPE_WILLEXITABRUPTLY);
-
- return $this;
- }
-
- public function handleEvent(PhutilEvent $event) {
- if (AphrontWriteGuard::isGuardActive()) {
- AphrontWriteGuard::getInstance()->disposeAbruptly();
- }
- }
-
-}
diff --git a/src/events/constant/PhutilEventType.php b/src/events/constant/PhutilEventType.php
--- a/src/events/constant/PhutilEventType.php
+++ b/src/events/constant/PhutilEventType.php
@@ -6,6 +6,5 @@
class PhutilEventType extends PhutilEventConstants {
const TYPE_ALL = '*';
- const TYPE_WILLEXITABRUPTLY = 'willexitabruptly';
}
diff --git a/src/utils/utils.php b/src/utils/utils.php
--- a/src/utils/utils.php
+++ b/src/utils/utils.php
@@ -857,21 +857,6 @@
}
/**
- * Fire an event allowing any listeners to clear up any outstanding requirements
- * before the request completes abruptly.
- *
- * @param int|string $status
- */
-function phutil_exit($status = 0) {
- $event = new PhutilEvent(
- PhutilEventType::TYPE_WILLEXITABRUPTLY,
- array('status' => $status));
- PhutilEventEngine::dispatchEvent($event);
-
- exit($status);
-}
-
-/**
* Converts a string to a loggable one, with unprintables and newlines escaped.
*
* @param string Any string.

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 19, 11:45 PM (8 h, 10 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6622002
Default Alt Text
D12885.id31040.diff (4 KB)

Event Timeline