OC_Util

class OC_Util
Source:lib/private/legacy/OC_Util.php#77

Properties

public property OC_Util::$scripts
Source:lib/private/legacy/OC_Util.php#78
public property OC_Util::$styles
Source:lib/private/legacy/OC_Util.php#79
public property OC_Util::$headers
Source:lib/private/legacy/OC_Util.php#80

Methods

protected static OC_Util::getAppManager()
Source:lib/private/legacy/OC_Util.php#87
public static OC_Util::setupFS($user="")
Can be set up
Source:

lib/private/legacy/OC_Util.php#187

Parameters:
  • $user (string)
Returns:

bool

public static OC_Util::isPublicLinkPasswordRequired()
check if a password is required for each public link
Source:lib/private/legacy/OC_Util.php#338
Returns:bool
public static OC_Util::isSharingDisabledForUser($config, $groupManager, $user)
check if sharing is disabled for the current user
Source:

lib/private/legacy/OC_Util.php#350

Parameters:
Returns:

bool

public static OC_Util::isDefaultExpireDateEnforced()
check if share API enforces a default expire date
Source:lib/private/legacy/OC_Util.php#378
Returns:bool
public static OC_Util::getUserQuota($user)
Get the quota of a user
Source:

lib/private/legacy/OC_Util.php#395

Parameters:
Returns:

float Quota bytes

public static OC_Util::copySkeleton($userId, $userDirectory)
copies the skeleton to the users /files
Source:

lib/private/legacy/OC_Util.php#415

Parameters:
Throws:

\OCP\Files\NotFoundException

Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\Files\NotFoundException

Throws:

\OCP\Files\NotPermittedException

public static OC_Util::copyr($source, $target)
copies a directory recursively by using streams
Source:

lib/private/legacy/OC_Util.php#465

Parameters:
Returns:

void

public static OC_Util::tearDownFS()
Source:lib/private/legacy/OC_Util.php#500
Returns:void
public static OC_Util::getVersion()
get the current installed version of ownCloud
Source:lib/private/legacy/OC_Util.php#512
Returns:array
public static OC_Util::getVersionString()
get the current installed version string of ownCloud
Source:lib/private/legacy/OC_Util.php#522
Returns:string
public static OC_Util::getEditionString()
Source:lib/private/legacy/OC_Util.php#531
Deprecated:the value is of no use anymore
Returns:string
public static OC_Util::getChannel()
Source:lib/private/legacy/OC_Util.php#539
Returns:string
public static OC_Util::getBuild()
Source:lib/private/legacy/OC_Util.php#548
Returns:string
public static OC_Util::addScript($application, $file=\null, $prepend=\false)
add a javascript file
Source:

lib/private/legacy/OC_Util.php#605

Parameters:
  • $application (string) application id
  • $file (string | null) filename
  • $prepend (bool) prepend the Script to the beginning of the list
Returns:

void

public static OC_Util::addVendorScript($application, $file=\null, $prepend=\false)
add a javascript file from the vendor sub folder
Source:

lib/private/legacy/OC_Util.php#623

Parameters:
  • $application (string) application id
  • $file (string | null) filename
  • $prepend (bool) prepend the Script to the beginning of the list
Returns:

void

public static OC_Util::addTranslations($application, $languageCode=\null, $prepend=\false)
add a translation JS file
Source:

lib/private/legacy/OC_Util.php#635

Parameters:
  • $application (string) application id
  • $languageCode (string | null) language code, defaults to the current language
  • $prepend (bool | null) prepend the Script to the beginning of the list
public static OC_Util::addStyle($application, $file=\null, $prepend=\false)
add a css file
Source:

lib/private/legacy/OC_Util.php#655

Parameters:
  • $application (string) application id
  • $file (string | null) filename
  • $prepend (bool) prepend the Style to the beginning of the list
Returns:

void

public static OC_Util::addVendorStyle($application, $file=\null, $prepend=\false)
add a css file from the vendor sub folder
Source:

lib/private/legacy/OC_Util.php#668

Parameters:
  • $application (string) application id
  • $file (string | null) filename
  • $prepend (bool) prepend the Style to the beginning of the list
Returns:

void

public static OC_Util::addHeader($tag, $attributes, $text=\null, $prepend=\false)
Add a custom element to the header
If $text is null then the element will be written as empty element.
So use “” to get a closing tag.
Source:

lib/private/legacy/OC_Util.php#711

Parameters:
  • $tag (string) tag name of the element
  • $attributes (array) array of attributes for the element
  • $text (string) the text content for the element
  • $prepend (bool) prepend the header to the beginning of the list
public static OC_Util::checkServer($config)
check if the current server configuration is suitable for ownCloud
Source:

lib/private/legacy/OC_Util.php#730

Parameters:
Returns:

array arrays with error messages and hints

public static OC_Util::checkDatabaseVersion()
Check the database version
Source:lib/private/legacy/OC_Util.php#982
Returns:array errors array
public static OC_Util::checkDataDirectoryPermissions($dataDirectory)
Check for correct file permissions of data directory
Source:

lib/private/legacy/OC_Util.php#1016

Parameters:
  • $dataDirectory (string)
Returns:

array arrays with error messages and hints

public static OC_Util::checkDataDirectoryValidity($dataDirectory)
Check that the data directory exists and is valid by
checking the existence of the ”.ocdata” file.
Source:

lib/private/legacy/OC_Util.php#1044

Parameters:
  • $dataDirectory (string) data directory path
Returns:

array errors found

public static OC_Util::checkLoggedIn()
Check if the user is logged in, redirects to home if not. With
redirect URL parameter to the request URI.
Source:lib/private/legacy/OC_Util.php#1069
Returns:void
public static OC_Util::checkAdminUser()
Check if the user is a admin, redirects to home if not
Source:lib/private/legacy/OC_Util.php#1093
Returns:void
public static OC_Util::getDefaultPageUrl()
Returns the URL of the default page
based on the system configuration and
the apps visible for the current user
Source:lib/private/legacy/OC_Util.php#1109
Returns:string URL
public static OC_Util::redirectToDefaultPage()
Redirect to the user default page
Source:lib/private/legacy/OC_Util.php#1157
Returns:void
public static OC_Util::getInstanceId()
get an id unique for this instance
Source:lib/private/legacy/OC_Util.php#1168
Returns:string
public static OC_Util::sanitizeHTML($value)
Public function to sanitize HTML
This function is used to sanitize HTML and should be applied on any
string or array of strings before displaying it on a web page.
Source:

lib/private/legacy/OC_Util.php#1187

Parameters:
  • $value (string | array)
Returns:

string | array an array of sanitized strings or a single sanitized string, depends on the input parameter.

public static OC_Util::encodePath($component)
Public function to encode url parameters
This function is used to encode path to file before output.
Encoding is done according to RFC 3986 with one exception:
Character ‘/’ is preserved as is.
Source:

lib/private/legacy/OC_Util.php#1209

Parameters:
  • $component (string) part of URI to encode
Returns:

string

public OC_Util::createHtaccessTestFile($config)
Source:lib/private/legacy/OC_Util.php#1216
public OC_Util::isHtaccessWorking($config)
Check if the .htaccess file is working
Source:

lib/private/legacy/OC_Util.php#1251

Parameters:
Returns:

bool

Throws:

\Exception

Throws:

\OC\HintException If the test file can’t get written.

Throws:

\Exception

Throws:

\OC\HintException If the test file can’t get written.

public static OC_Util::isSetLocaleWorking()
Check if the setlocal call does not work. This can happen if the right
local packages are not available on the server.
Source:lib/private/legacy/OC_Util.php#1300
Returns:bool
public static OC_Util::isAnnotationsWorking()
Check if it’s possible to get the inline annotations
Source:lib/private/legacy/OC_Util.php#1319
Returns:bool
public static OC_Util::fileInfoLoaded()
Check if the PHP module fileinfo is loaded.
Source:lib/private/legacy/OC_Util.php#1331
Returns:bool
public static OC_Util::obEnd()
clear all levels of output buffering
Source:lib/private/legacy/OC_Util.php#1340
Returns:void
public static OC_Util::runningOnMac()
Checks whether the server is running on Mac OS X
Source:lib/private/legacy/OC_Util.php#1351
Returns:bool true if running on Mac OS X, false otherwise
public static OC_Util::getTheme()
Handles the case that there may not be a theme, then check if a “default”
theme exists and take that one
Source:lib/private/legacy/OC_Util.php#1361
Returns:string the theme
public static OC_Util::normalizeUnicode($value)
Normalize a unicode string
Source:

lib/private/legacy/OC_Util.php#1379

Parameters:
  • $value (string) a not normalized string
Returns:

bool | string

public static OC_Util::getHumanVersion()
A human readable string is generated based on version and build number
Source:lib/private/legacy/OC_Util.php#1398
Returns:string
public static OC_Util::isValidFileName($file)
Returns whether the given file name is valid
Source:

lib/private/legacy/OC_Util.php#1414

Parameters:
  • $file (string) file name to check
Returns:

bool true if the file name is valid, false otherwise

Deprecated:

use \OC\Files\View::verifyPath()

public static OC_Util::needUpgrade($config)
Check whether the instance needs to perform an upgrade,
either when the core version is higher or any app requires
an upgrade.
Source:

lib/private/legacy/OC_Util.php#1445

Parameters:
Returns:

bool whether the core or any app needs an upgrade

Throws:

\OC\HintException When the upgrade from the given version is not allowed

public static OC_Util::isIe()
is this Internet explorer ?
Source:lib/private/legacy/OC_Util.php#1490
Returns:bool