Differential D19801 Diff 47306 src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
Show First 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | public function applyPatchSQL($sql) { | ||||
foreach ($queries as $query) { | foreach ($queries as $query) { | ||||
$query = str_replace('{$NAMESPACE}', $this->namespace, $query); | $query = str_replace('{$NAMESPACE}', $this->namespace, $query); | ||||
foreach ($charset_info as $key => $value) { | foreach ($charset_info as $key => $value) { | ||||
$query = str_replace('{$'.$key.'}', $value, $query); | $query = str_replace('{$'.$key.'}', $value, $query); | ||||
} | } | ||||
try { | try { | ||||
queryfx($conn, '%Q', $query); | // NOTE: We're using the unsafe "%Z" conversion here. There's no | ||||
// avoiding it since we're executing raw text files full of SQL. | |||||
queryfx($conn, '%Z', $query); | |||||
} catch (AphrontAccessDeniedQueryException $ex) { | } catch (AphrontAccessDeniedQueryException $ex) { | ||||
throw new PhutilProxyException( | throw new PhutilProxyException( | ||||
pht( | pht( | ||||
'Unable to access a required database or table. This almost '. | 'Unable to access a required database or table. This almost '. | ||||
'always means that the user you are connecting with ("%s") does '. | 'always means that the user you are connecting with ("%s") does '. | ||||
'not have sufficient permissions granted in MySQL. You can '. | 'not have sufficient permissions granted in MySQL. You can '. | ||||
'use `bin/storage databases` to get a list of all databases '. | 'use `bin/storage databases` to get a list of all databases '. | ||||
'permission is required on.', | 'permission is required on.', | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |