idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
24,300 | protected function deleteArchiveIds ( Date $ date , $ idArchivesToDelete ) { $ batches = array_chunk ( $ idArchivesToDelete , 1000 ) ; $ numericTable = ArchiveTableCreator :: getNumericTable ( $ date ) ; $ blobTable = ArchiveTableCreator :: getBlobTable ( $ date ) ; $ deletedCount = 0 ; foreach ( $ batches as $ idsToDe... | Deletes by batches Archive IDs in the specified month |
24,301 | public function getJavascriptTag ( $ idSite , $ piwikUrl = '' , $ mergeSubdomains = false , $ groupPageTitlesByDomain = false , $ mergeAliasUrls = false , $ visitorCustomVariables = false , $ pageCustomVariables = false , $ customCampaignNameQueryParam = false , $ customCampaignKeywordParam = false , $ doNotTrack = fal... | Returns the javascript tag for the given idSite . This tag must be included on every page to be tracked by Matomo |
24,302 | public function getImageTrackingCode ( $ idSite , $ piwikUrl = '' , $ actionName = false , $ idGoal = false , $ revenue = false , $ forceMatomoEndpoint = false ) { $ urlParams = array ( 'idsite' => $ idSite , 'rec' => 1 ) ; if ( $ actionName !== false ) { $ urlParams [ 'action_name' ] = urlencode ( Common :: unsanitize... | Returns image link tracking code for a given site with specified options . |
24,303 | public function getAllSites ( ) { Piwik :: checkUserHasSuperUserAccess ( ) ; $ sites = $ this -> getModel ( ) -> getAllSites ( ) ; $ return = array ( ) ; foreach ( $ sites as $ site ) { $ this -> enrichSite ( $ site ) ; $ return [ $ site [ 'idsite' ] ] = $ site ; } $ return = Site :: setSitesFromArray ( $ return ) ; re... | Returns all websites requires Super User access |
24,304 | public function getSitesIdWithVisits ( $ timestamp = false ) { Piwik :: checkUserHasSuperUserAccess ( ) ; if ( empty ( $ timestamp ) ) $ timestamp = time ( ) ; $ time = Date :: factory ( ( int ) $ timestamp ) -> getDatetime ( ) ; $ now = Date :: now ( ) -> addHour ( 1 ) -> getDatetime ( ) ; $ result = $ this -> getMode... | Returns the list of the website IDs that received some visits since the specified timestamp . Requires Super User access . |
24,305 | public function getSitesWithAdminAccess ( $ fetchAliasUrls = false , $ pattern = false , $ limit = false ) { $ sitesId = $ this -> getSitesIdWithAdminAccess ( ) ; if ( $ pattern === false ) { $ sites = $ this -> getSitesFromIds ( $ sitesId , $ limit ) ; } else { $ sites = $ this -> getModel ( ) -> getPatternMatchSites ... | Returns the list of websites with the admin access for the current user . For the superUser it returns all the websites in the database . |
24,306 | public function getSitesWithAtLeastViewAccess ( $ limit = false , $ _restrictSitesToLogin = false ) { $ sitesId = $ this -> getSitesIdWithAtLeastViewAccess ( $ _restrictSitesToLogin ) ; return $ this -> getSitesFromIds ( $ sitesId , $ limit ) ; } | Returns the list of websites with the view or admin access for the current user . For the superUser it returns all the websites in the database . |
24,307 | public function getSitesIdWithAtLeastViewAccess ( $ _restrictSitesToLogin = false ) { $ scheduler = StaticContainer :: getContainer ( ) -> get ( 'Piwik\Scheduler\Scheduler' ) ; if ( Piwik :: hasUserSuperUserAccess ( ) && ! $ scheduler -> isRunningTask ( ) ) { return Access :: getInstance ( ) -> getSitesIdWithAtLeastVie... | Returns the list of websites ID with the view or admin access for the current user . For the superUser it returns all the websites in the database . |
24,308 | private function getSitesFromIds ( $ idSites , $ limit = false ) { $ sites = $ this -> getModel ( ) -> getSitesFromIds ( $ idSites , $ limit ) ; foreach ( $ sites as & $ site ) { $ this -> enrichSite ( $ site ) ; } $ sites = Site :: setSitesFromArray ( $ sites ) ; return $ sites ; } | Returns the list of websites from the ID array in parameters . The user access is not checked in this method so the ID have to be accessible by the user! |
24,309 | public function addSiteAliasUrls ( $ idSite , $ urls ) { Piwik :: checkUserHasAdminAccess ( $ idSite ) ; if ( empty ( $ urls ) ) { return 0 ; } if ( ! is_array ( $ urls ) ) { $ urls = array ( $ urls ) ; } $ urlsInit = $ this -> getSiteUrlsFromId ( $ idSite ) ; $ toInsert = array_merge ( $ urlsInit , $ urls ) ; $ urlsPr... | Add a list of alias Urls to the given idSite |
24,310 | public function setSiteAliasUrls ( $ idSite , $ urls = array ( ) ) { Piwik :: checkUserHasAdminAccess ( $ idSite ) ; $ mainUrl = Site :: getMainUrlFor ( $ idSite ) ; array_unshift ( $ urls , $ mainUrl ) ; $ urlsProperty = new Urls ( $ idSite ) ; $ urlsProperty -> setValue ( $ urls ) ; $ urlsProperty -> save ( ) ; $ ins... | Set the list of alias Urls for the given idSite |
24,311 | public function getIpsForRange ( $ ipRange ) { $ range = IPUtils :: getIPRangeBounds ( $ ipRange ) ; if ( $ range === null ) { return false ; } return array ( IPUtils :: binaryToStringIP ( $ range [ 0 ] ) , IPUtils :: binaryToStringIP ( $ range [ 1 ] ) ) ; } | Get the start and end IP addresses for an IP address range |
24,312 | public function setGlobalExcludedIps ( $ excludedIps ) { Piwik :: checkUserHasSuperUserAccess ( ) ; $ excludedIps = $ this -> checkAndReturnExcludedIps ( $ excludedIps ) ; Option :: set ( self :: OPTION_EXCLUDED_IPS_GLOBAL , $ excludedIps ) ; Cache :: deleteTrackerCache ( ) ; return true ; } | Sets IPs to be excluded from all websites . IPs can contain wildcards . Will also apply to websites created in the future . |
24,313 | public function setSiteSpecificUserAgentExcludeEnabled ( $ enabled ) { Piwik :: checkUserHasSuperUserAccess ( ) ; Option :: set ( self :: OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE , $ enabled ) ; Cache :: deleteTrackerCache ( ) ; } | Sets whether it should be allowed to exclude different user agents for different websites . |
24,314 | public function setKeepURLFragmentsGlobal ( $ enabled ) { Piwik :: checkUserHasSuperUserAccess ( ) ; Option :: set ( self :: OPTION_KEEP_URL_FRAGMENTS_GLOBAL , $ enabled ) ; Cache :: deleteTrackerCache ( ) ; } | Sets whether the default behavior should be to keep URL fragments when tracking or not . |
24,315 | public function setGlobalExcludedQueryParameters ( $ excludedQueryParameters ) { Piwik :: checkUserHasSuperUserAccess ( ) ; $ excludedQueryParameters = $ this -> checkAndReturnCommaSeparatedStringList ( $ excludedQueryParameters ) ; Option :: set ( self :: OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL , $ excludedQueryParame... | Sets list of URL query parameters to be excluded on all websites . Will also apply to websites created in the future . |
24,316 | public function getDefaultCurrency ( ) { Piwik :: checkUserHasSomeAdminAccess ( ) ; $ defaultCurrency = Option :: get ( self :: OPTION_DEFAULT_CURRENCY ) ; if ( $ defaultCurrency ) { return $ defaultCurrency ; } return 'USD' ; } | Returns the default currency that will be set when creating a website through the API . |
24,317 | public function setDefaultCurrency ( $ defaultCurrency ) { Piwik :: checkUserHasSuperUserAccess ( ) ; $ this -> checkValidCurrency ( $ defaultCurrency ) ; Option :: set ( self :: OPTION_DEFAULT_CURRENCY , $ defaultCurrency ) ; return true ; } | Sets the default currency that will be used when creating websites |
24,318 | public function setDefaultTimezone ( $ defaultTimezone ) { Piwik :: checkUserHasSuperUserAccess ( ) ; $ this -> checkValidTimezone ( $ defaultTimezone ) ; Option :: set ( self :: OPTION_DEFAULT_TIMEZONE , $ defaultTimezone ) ; return true ; } | Sets the default timezone that will be used when creating websites |
24,319 | public function getCurrencyList ( ) { $ currency = Site :: getCurrencyList ( ) ; $ return = array ( ) ; foreach ( array_keys ( Site :: getCurrencyList ( ) ) as $ currencyCode ) { $ return [ $ currencyCode ] = Piwik :: translate ( 'Intl_Currency_' . $ currencyCode ) . ' (' . Piwik :: translate ( 'Intl_CurrencySymbol_' .... | Returns the list of supported currencies |
24,320 | public function getTimezonesList ( ) { if ( ! SettingsServer :: isTimezoneSupportEnabled ( ) ) { return array ( 'UTC' => $ this -> getTimezonesListUTCOffsets ( ) ) ; } $ countries = StaticContainer :: get ( 'Piwik\Intl\Data\Provider\RegionDataProvider' ) -> getCountryList ( ) ; $ return = array ( ) ; $ continents = arr... | Returns the list of timezones supported . Used for addSite and updateSite |
24,321 | private function removeTrailingSlash ( $ url ) { if ( strlen ( $ url ) > 5 && $ url [ strlen ( $ url ) - 1 ] == '/' ) { $ url = substr ( $ url , 0 , strlen ( $ url ) - 1 ) ; } return $ url ; } | Remove the final slash in the URLs if found |
24,322 | public function getPatternMatchSites ( $ pattern , $ limit = false ) { $ ids = $ this -> getSitesIdWithAtLeastViewAccess ( ) ; if ( empty ( $ ids ) ) { return array ( ) ; } $ sites = $ this -> getModel ( ) -> getPatternMatchSites ( $ ids , $ pattern , $ limit ) ; foreach ( $ sites as & $ site ) { $ this -> enrichSite (... | Find websites matching the given pattern . |
24,323 | private function buildSelectQuery ( $ select , $ from , $ where , $ groupBy , $ orderBy , $ limitAndOffset ) { $ sql = " SELECT $select FROM $from" ; if ( $ where ) { $ sql .= " WHERE $where" ; } if ( $ groupBy ) { $ sql .= " GROUP BY $groupBy" ; } if ( $ orderBy ) { $ sql .= " ORDER BY $orderB... | Build select query the normal way |
24,324 | public function getCompiledBaseCss ( ) { $ mergedAsset = new InMemoryUIAsset ( ) ; $ assetMerger = new StylesheetUIAssetMerger ( $ mergedAsset , $ this -> minimalStylesheetFetcher , $ this -> cacheBuster ) ; $ assetMerger -> generateFile ( ) ; return $ mergedAsset ; } | Return the base . less compiled to css |
24,325 | public function getMergedStylesheet ( ) { $ mergedAsset = $ this -> getMergedStylesheetAsset ( ) ; $ assetFetcher = new StylesheetUIAssetFetcher ( Manager :: getInstance ( ) -> getLoadedPluginsName ( ) , $ this -> theme ) ; $ assetMerger = new StylesheetUIAssetMerger ( $ mergedAsset , $ assetFetcher , $ this -> cacheBu... | Return the css merged file absolute location . If there is none the generation process will be triggered . |
24,326 | public function removeMergedAssets ( $ pluginName = false ) { $ assetsToRemove = array ( $ this -> getMergedStylesheetAsset ( ) ) ; if ( $ pluginName ) { if ( $ this -> pluginContainsJScriptAssets ( $ pluginName ) ) { if ( Manager :: getInstance ( ) -> isPluginBundledWithCore ( $ pluginName ) ) { $ assetsToRemove [ ] =... | Remove previous merged assets |
24,327 | public function getAssetDirectory ( ) { $ mergedFileDirectory = StaticContainer :: get ( 'path.tmp' ) . '/assets' ; if ( ! is_dir ( $ mergedFileDirectory ) ) { Filesystem :: mkdir ( $ mergedFileDirectory ) ; } if ( ! is_writable ( $ mergedFileDirectory ) ) { throw new Exception ( "Directory " . $ mergedFileDirectory . ... | Check if the merged file directory exists and is writable . |
24,328 | public function isMergedAssetsDisabled ( ) { if ( Config :: getInstance ( ) -> Development [ 'disable_merged_assets' ] == 1 ) { return true ; } if ( isset ( $ _GET [ 'disable_merged_assets' ] ) && $ _GET [ 'disable_merged_assets' ] == 1 ) { return true ; } return false ; } | Return the global option disable_merged_assets |
24,329 | public function setDefaultAction ( $ actionName , $ imageSrc = '' ) { if ( 0 == count ( $ this -> form ) ) { $ image = $ this -> form -> appendChild ( new HTML_QuickForm2_Controller_DefaultAction ( $ this -> getButtonName ( $ actionName ) , array ( 'src' => $ imageSrc ) ) ) ; } elseif ( $ image = $ this -> form -> getE... | Sets the default action invoked on page - form submit |
24,330 | public function makeId ( $ callback , array $ args = array ( ) ) { if ( ! is_callable ( $ callback , true , $ name ) ) { Zend_Cache :: throwException ( 'Invalid callback' ) ; } $ name = strtolower ( $ name ) ; if ( is_object ( $ callback ) ) { $ object = $ callback ; } elseif ( isset ( $ callback [ 0 ] ) ) { $ object =... | Make a cache id from the function name and parameters |
24,331 | protected function getSiteInfoFromQueryParam ( $ idSites , $ _restrictSitesToLogin ) { $ websiteIds = Site :: getIdSitesFromIdSitesString ( $ idSites , $ _restrictSitesToLogin ) ; $ timezone = false ; if ( count ( $ websiteIds ) == 1 ) { $ timezone = Site :: getTimezoneFor ( $ websiteIds [ 0 ] ) ; } $ idSiteIsAll = $ i... | Parses the site ID string provided in the idSite query parameter to a list of website IDs . |
24,332 | protected function getPeriodInfoFromQueryParam ( $ strDate , $ strPeriod , $ timezone ) { if ( Period :: isMultiplePeriod ( $ strDate , $ strPeriod ) ) { $ oPeriod = PeriodFactory :: build ( $ strPeriod , $ strDate , $ timezone ) ; $ allPeriods = $ oPeriod -> getSubperiods ( ) ; } else { $ oPeriod = PeriodFactory :: ma... | Parses the date & period query parameters into a list of periods . |
24,333 | public function checkClientVersion ( ) { $ serverVersion = $ this -> getServerVersion ( ) ; $ clientVersion = $ this -> getClientVersion ( ) ; if ( version_compare ( $ serverVersion , '10' ) >= 0 && version_compare ( $ clientVersion , '10' ) < 0 ) { throw new Exception ( Piwik :: translate ( 'General_ExceptionIncompati... | Check client version compatibility against database server |
24,334 | public function findComponent ( $ componentName , $ expectedSubclass ) { $ this -> createCacheIfNeeded ( ) ; $ cacheId = 'Plugin' . $ this -> pluginName . $ componentName . $ expectedSubclass ; $ pluginsDir = Manager :: getPluginDirectory ( $ this -> pluginName ) ; $ componentFile = sprintf ( '%s/%s.php' , $ pluginsDir... | Tries to find a component such as a Menu or Tasks within this plugin . |
24,335 | public static function getPluginNameFromBacktrace ( $ backtrace ) { foreach ( $ backtrace as $ tracepoint ) { if ( isset ( $ tracepoint [ 'class' ] ) ) { $ className = self :: getPluginNameFromNamespace ( $ tracepoint [ 'class' ] ) ; if ( $ className ) { return $ className ; } } } return false ; } | Extracts the plugin name from a backtrace array . Returns false if we can t find one . |
24,336 | public function aggregateDataTableRecords ( $ recordNames , $ maximumRowsInDataTableLevelZero = null , $ maximumRowsInSubDataTable = null , $ columnToSortByBeforeTruncation = null , & $ columnsAggregationOperation = null , $ columnsToRenameAfterAggregation = null , $ countRowsRecursive = true ) { if ( ! is_array ( $ re... | Sums records for every subperiod of the current period and inserts the result as the record for this period . |
24,337 | public function aggregateNumericMetrics ( $ columns , $ operationToApply = false ) { $ metrics = $ this -> getAggregatedNumericMetrics ( $ columns , $ operationToApply ) ; foreach ( $ metrics as $ column => $ value ) { $ value = Common :: forceDotAsSeparatorForDecimalPoint ( $ value ) ; $ this -> archiveWriter -> inser... | Aggregates one or more metrics for every subperiod of the current period and inserts the results as metrics for the current period . |
24,338 | public function insertNumericRecords ( $ numericRecords ) { foreach ( $ numericRecords as $ name => $ value ) { $ this -> insertNumericRecord ( $ name , $ value ) ; } } | Caches multiple numeric records in the archive for this processor s site period and segment . |
24,339 | public function insertNumericRecord ( $ name , $ value ) { $ value = round ( $ value , 2 ) ; $ value = Common :: forceDotAsSeparatorForDecimalPoint ( $ value ) ; $ this -> archiveWriter -> insertRecord ( $ name , $ value ) ; } | Caches a single numeric record in the archive for this processor s site period and segment . |
24,340 | protected function computeNbUniques ( $ metrics ) { $ logAggregator = $ this -> getLogAggregator ( ) ; $ query = $ logAggregator -> queryVisitsByDimension ( array ( ) , false , array ( ) , $ metrics ) ; $ data = $ query -> fetch ( ) ; return $ data ; } | Processes number of unique visitors for the given period |
24,341 | protected function getAggregatedDataTableMap ( $ data , $ columnsAggregationOperation ) { $ table = new DataTable ( ) ; if ( ! empty ( $ columnsAggregationOperation ) ) { $ table -> setMetadata ( DataTable :: COLUMN_AGGREGATION_OPS_METADATA_NAME , $ columnsAggregationOperation ) ; } if ( $ data instanceof DataTable \ M... | If the DataTable is a Map sums all DataTable in the map and return the DataTable . |
24,342 | public function processDependentArchive ( $ plugin , $ segment ) { $ params = $ this -> getParams ( ) ; if ( ! $ params -> isRootArchiveRequest ( ) ) { return ; } $ idSites = [ $ params -> getSite ( ) -> getId ( ) ] ; $ newSegment = Segment :: combine ( $ params -> getSegment ( ) -> getString ( ) , SegmentExpression ::... | Initiate archiving for a plugin during an ongoing archiving . The plugin can be another plugin or the same plugin . |
24,343 | public function describeTable ( $ tableName , $ schemaName = null ) { $ sql = "SELECT DISTINCT t.owner, t.tabname, c.colname, c.colno, c.coltype, d.default, c.collength, t.tabid FROM syscolumns c JOIN systables t ON c.tabid = t.tabid LEFT JOIN sysdefaults d ON c.t... | IDS catalog lookup for describe table |
24,344 | protected function _getPrimaryInfo ( $ tabid ) { $ sql = "SELECT i.part1, i.part2, i.part3, i.part4, i.part5, i.part6, i.part7, i.part8, i.part9, i.part10, i.part11, i.part12, i.part13, i.part14, i.part15, i.part16 FROM sysindexes i JOIN sysconstraints c ON c.... | Helper method to retrieve primary key column and column location |
24,345 | public function limit ( $ sql , $ count , $ offset = 0 ) { $ count = intval ( $ count ) ; if ( $ count < 0 ) { throw new Zend_Db_Adapter_Exception ( "LIMIT argument count=$count is not valid" ) ; } else if ( $ count == 0 ) { $ limit_sql = str_ireplace ( "SELECT" , "SELECT * FROM (SELECT" , $ sql ) ; $ limit_sql .= ") W... | Adds an IDS - specific LIMIT clause to the SELECT statement . |
24,346 | public function nextSequenceId ( $ sequenceName ) { $ sql = 'SELECT ' . $ this -> _adapter -> quoteIdentifier ( $ sequenceName ) . '.NEXTVAL FROM ' . 'systables WHERE tabid = 1' ; $ value = $ this -> _adapter -> fetchOne ( $ sql ) ; return $ value ; } | IDS - specific sequence id value |
24,347 | public function render ( ) { $ data = $ this -> _config -> toArray ( ) ; $ sectionName = $ this -> _config -> getSectionName ( ) ; $ extends = $ this -> _config -> getExtends ( ) ; if ( is_string ( $ sectionName ) ) { $ data = array ( $ sectionName => $ data ) ; } foreach ( $ extends as $ section => $ parentSection ) {... | Render a Zend_Config into a JSON config string . |
24,348 | public function getIdsNotMatchingTags ( $ tags = array ( ) ) { $ res = $ this -> _query ( "SELECT id FROM cache" ) ; $ rows = @ sqlite_fetch_all ( $ res , SQLITE_ASSOC ) ; $ result = array ( ) ; foreach ( $ rows as $ row ) { $ id = $ row [ 'id' ] ; $ matching = false ; foreach ( $ tags as $ tag ) { $ res = $ this -> _q... | Return an array of stored cache ids which don t match given tags |
24,349 | private function _getConnection ( ) { if ( is_resource ( $ this -> _db ) ) { return $ this -> _db ; } else { $ this -> _db = @ sqlite_open ( $ this -> _options [ 'cache_db_complete_path' ] ) ; if ( ! ( is_resource ( $ this -> _db ) ) ) { Zend_Cache :: throwException ( "Impossible to open " . $ this -> _options [ 'cache... | Return the connection resource |
24,350 | private function _query ( $ query ) { $ db = $ this -> _getConnection ( ) ; if ( is_resource ( $ db ) ) { $ res = @ sqlite_query ( $ db , $ query ) ; if ( $ res === false ) { return false ; } else { return $ res ; } } return false ; } | Execute an SQL query silently |
24,351 | private function _automaticVacuum ( ) { if ( $ this -> _options [ 'automatic_vacuum_factor' ] > 0 ) { $ rand = rand ( 1 , $ this -> _options [ 'automatic_vacuum_factor' ] ) ; if ( $ rand == 1 ) { $ this -> _query ( 'VACUUM' ) ; } } } | Deal with the automatic vacuum process |
24,352 | private function _registerTag ( $ id , $ tag ) { $ res = $ this -> _query ( "DELETE FROM TAG WHERE name='$tag' AND id='$id'" ) ; $ res = $ this -> _query ( "INSERT INTO tag (name, id) VALUES ('$tag', '$id')" ) ; if ( ! $ res ) { $ this -> _log ( "Zend_Cache_Backend_Sqlite::_registerTag() : impossible to register tag=$t... | Register a cache id with the given tag |
24,353 | private function _buildStructure ( ) { $ this -> _query ( 'DROP INDEX tag_id_index' ) ; $ this -> _query ( 'DROP INDEX tag_name_index' ) ; $ this -> _query ( 'DROP INDEX cache_id_expire_index' ) ; $ this -> _query ( 'DROP TABLE version' ) ; $ this -> _query ( 'DROP TABLE cache' ) ; $ this -> _query ( 'DROP TABLE tag' )... | Build the database structure |
24,354 | private function getGeoIpInstance ( $ key ) { if ( empty ( $ this -> geoIpCache [ $ key ] ) ) { parent :: getRegionNames ( ) ; require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipcity.inc' ; $ pathToDb = self :: getPathToGeoIpDatabase ( $ this -> customDbNames [ $ key ] ) ; if ( $ pathToDb !== false ) { $ this -... | Returns a GeoIP instance . Creates it if necessary . |
24,355 | private static function getSchemaClassName ( $ schemaName ) { if ( strtolower ( $ schemaName ) == 'myisam' || empty ( $ schemaName ) ) { $ schemaName = self :: DEFAULT_SCHEMA ; } $ class = str_replace ( ' ' , '\\' , ucwords ( str_replace ( '_' , ' ' , strtolower ( $ schemaName ) ) ) ) ; return '\Piwik\Db\Schema\\' . $ ... | Get schema class name |
24,356 | public function filterUrl ( $ url ) { $ path = parse_url ( $ url , PHP_URL_PATH ) ; if ( strpos ( $ path , 'index.php/' ) !== false ) { return preg_replace ( '#index\.php/([^\?]*)#' , 'index.php' , $ url , 1 ) ; } return null ; } | Filters some malformed URL by suggesting to redirect them . |
24,357 | public function exec ( $ sql ) { if ( $ sql instanceof Zend_Db_Select ) { $ sql = $ sql -> assemble ( ) ; } try { $ affected = $ this -> getConnection ( ) -> exec ( $ sql ) ; if ( $ affected === false ) { $ errorInfo = $ this -> getConnection ( ) -> errorInfo ( ) ; throw new Zend_Db_Adapter_Exception ( $ errorInfo [ 2 ... | Executes an SQL statement and return the number of affected rows |
24,358 | public function setFetchMode ( $ mode ) { if ( ! extension_loaded ( 'pdo' ) ) { throw new Zend_Db_Adapter_Exception ( 'The PDO extension is required for this adapter but the extension is not loaded' ) ; } switch ( $ mode ) { case PDO :: FETCH_LAZY : case PDO :: FETCH_ASSOC : case PDO :: FETCH_NUM : case PDO :: FETCH_BO... | Set the PDO fetch mode . |
24,359 | protected function applyGenericFilters ( $ datatable ) { if ( $ datatable instanceof DataTable \ Map ) { $ tables = $ datatable -> getDataTables ( ) ; foreach ( $ tables as $ table ) { $ this -> applyGenericFilters ( $ table ) ; } return ; } $ tableDisabledFilters = $ datatable -> getMetadata ( DataTable :: GENERIC_FIL... | Apply generic filters to the DataTable object resulting from the API Call . Disable this feature by setting the parameter disable_generic_filters to 1 in the API call request . |
24,360 | public function getBrand ( $ idSite , $ period , $ date , $ segment = false ) { $ dataTable = $ this -> getDataTable ( 'DevicesDetection_brands' , $ idSite , $ period , $ date , $ segment ) ; $ dataTable -> filter ( 'GroupBy' , array ( 'label' , __NAMESPACE__ . '\getDeviceBrandLabel' ) ) ; $ dataTable -> filter ( 'Colu... | Gets datatable displaying number of visits by device manufacturer name |
24,361 | public function getModel ( $ idSite , $ period , $ date , $ segment = false ) { $ dataTable = $ this -> getDataTable ( 'DevicesDetection_models' , $ idSite , $ period , $ date , $ segment ) ; $ dataTable -> filter ( function ( DataTable $ table ) { foreach ( $ table -> getRowsWithoutSummaryRow ( ) as $ row ) { $ label ... | Gets datatable displaying number of visits by device model |
24,362 | protected function mergeDataTables ( DataTable \ DataTableInterface $ dataTable , DataTable \ DataTableInterface $ dataTable2 ) { if ( $ dataTable instanceof DataTable \ Map ) { $ dataTables = $ dataTable -> getDataTables ( ) ; foreach ( $ dataTables as $ label => $ table ) { $ versionDataTables = $ dataTable2 -> getDa... | That methods handles the fallback to version datatables to calculate those without versions . |
24,363 | protected function isAllowedToTroubleshootAsSuperUser ( ) { $ isAllowedToTroubleshootAsSuperUser = false ; $ salt = SettingsPiwik :: getSalt ( ) ; if ( ! empty ( $ salt ) ) { $ saltFromRequest = Common :: getRequestVar ( 'i_am_super_user' , '' , 'string' ) ; $ isAllowedToTroubleshootAsSuperUser = ( $ salt == $ saltFrom... | Let Super User troubleshoot in safe mode even when Login is broken with this special trick |
24,364 | public static function getArrayFromQueryString ( $ urlQuery ) { if ( strlen ( $ urlQuery ) == 0 ) { return array ( ) ; } $ cache = Cache :: getTransientCache ( ) ; $ cacheKey = 'arrayFromQuery' . $ urlQuery ; if ( $ cache -> contains ( $ cacheKey ) ) { return $ cache -> fetch ( $ cacheKey ) ; } if ( $ urlQuery [ 0 ] ==... | Returns a URL query string as an array . |
24,365 | public static function getParameterFromQueryString ( $ urlQuery , $ parameter ) { $ nameToValue = self :: getArrayFromQueryString ( $ urlQuery ) ; if ( isset ( $ nameToValue [ $ parameter ] ) ) { return $ nameToValue [ $ parameter ] ; } return null ; } | Returns the value of a single query parameter from the supplied query string . |
24,366 | public static function getPathAndQueryFromUrl ( $ url ) { $ parsedUrl = parse_url ( $ url ) ; $ result = '' ; if ( isset ( $ parsedUrl [ 'path' ] ) ) { if ( substr ( $ parsedUrl [ 'path' ] , 0 , 1 ) == '/' ) { $ parsedUrl [ 'path' ] = substr ( $ parsedUrl [ 'path' ] , 1 ) ; } $ result .= $ parsedUrl [ 'path' ] ; } if (... | Returns the path and query string of a URL . |
24,367 | public static function getQueryFromUrl ( $ url , array $ additionalParamsToAdd = array ( ) ) { $ url = @ parse_url ( $ url ) ; $ query = '' ; if ( ! empty ( $ url [ 'query' ] ) ) { $ query .= $ url [ 'query' ] ; } if ( ! empty ( $ additionalParamsToAdd ) ) { if ( ! empty ( $ query ) ) { $ query .= '&' ; } $ query .= Ur... | Returns the query part from any valid url and adds additional parameters to the query part if needed . |
24,368 | public function getValidationStatus ( $ pageId ) { return array_key_exists ( $ pageId , $ this -> data [ 'valid' ] ) ? $ this -> data [ 'valid' ] [ $ pageId ] : null ; } | Returns the page validation status kept in session |
24,369 | public function storeDatasources ( array $ datasources ) { foreach ( $ datasources as $ ds ) { if ( ! $ ds instanceof HTML_QuickForm2_DataSource ) { throw new HTML_QuickForm2_InvalidArgumentException ( 'Array should contain only DataSource instances' ) ; } } $ this -> data [ 'datasources' ] = $ datasources ; } | Stores the controller data sources |
24,370 | public function storeOpaque ( $ name , $ value ) { if ( ! array_key_exists ( 'opaque' , $ this -> data ) ) { $ this -> data [ 'opaque' ] = array ( ) ; } $ this -> data [ 'opaque' ] [ $ name ] = $ value ; } | Stores some user - supplied parameter alongside controller data |
24,371 | public function getOpaque ( $ name ) { return ( array_key_exists ( 'opaque' , $ this -> data ) && array_key_exists ( $ name , $ this -> data [ 'opaque' ] ) ) ? $ this -> data [ 'opaque' ] [ $ name ] : null ; } | Returns a user - supplied parameter |
24,372 | public function getMetricId ( ) { if ( ! empty ( $ this -> metricId ) ) { return $ this -> metricId ; } $ id = $ this -> getId ( ) ; return str_replace ( array ( '.' , ' ' , '-' ) , '_' , strtolower ( $ id ) ) ; } | Get the metricId which is used to generate metric names based on this dimension . |
24,373 | public function getName ( ) { if ( ! empty ( $ this -> nameSingular ) ) { return Piwik :: translate ( $ this -> nameSingular ) ; } return $ this -> nameSingular ; } | Returns the translated name of this dimension which is typically in singular . |
24,374 | public function getNamePlural ( ) { if ( ! empty ( $ this -> namePlural ) ) { return Piwik :: translate ( $ this -> namePlural ) ; } return $ this -> getName ( ) ; } | Returns a translated name in plural for this dimension . |
24,375 | public function groupValue ( $ value , $ idSite ) { switch ( $ this -> type ) { case Dimension :: TYPE_URL : return str_replace ( array ( 'http://' , 'https://' ) , '' , $ value ) ; case Dimension :: TYPE_BOOL : return ! empty ( $ value ) ? '1' : '0' ; case Dimension :: TYPE_DURATION_MS : return number_format ( $ value... | A dimension should group values by using this method . Otherwise the same row may appear several times . |
24,376 | public function formatValue ( $ value , $ idSite , Formatter $ formatter ) { switch ( $ this -> type ) { case Dimension :: TYPE_BOOL : if ( empty ( $ value ) ) { return Piwik :: translate ( 'General_No' ) ; } return Piwik :: translate ( 'General_Yes' ) ; case Dimension :: TYPE_ENUM : $ values = $ this -> getEnumColumnV... | Formats the dimension value . By default the dimension is formatted based on the set dimension type . |
24,377 | public function configureMetrics ( MetricsList $ metricsList , DimensionMetricFactory $ dimensionMetricFactory ) { if ( $ this -> getMetricId ( ) && $ this -> dbTableName && $ this -> columnName && $ this -> getNamePlural ( ) ) { if ( in_array ( $ this -> getType ( ) , array ( self :: TYPE_DATETIME , self :: TYPE_DATE ... | Configures metrics for this dimension . |
24,378 | public function hasImplementedEvent ( $ method ) { $ method = new \ ReflectionMethod ( $ this , $ method ) ; $ declaringClass = $ method -> getDeclaringClass ( ) ; return 0 === strpos ( $ declaringClass -> name , 'Piwik\Plugins' ) ; } | Check whether a dimension has overwritten a specific method . |
24,379 | public function getSqlSegment ( ) { if ( ! empty ( $ this -> sqlSegment ) ) { return $ this -> sqlSegment ; } if ( $ this -> dbTableName && $ this -> columnName ) { return $ this -> dbTableName . '.' . $ this -> columnName ; } } | Returns a sql segment expression for this dimension . |
24,380 | public static function getAllDimensions ( ) { $ cacheId = CacheId :: siteAware ( CacheId :: pluginAware ( 'AllDimensions' ) ) ; $ cache = PiwikCache :: getTransientCache ( ) ; if ( ! $ cache -> contains ( $ cacheId ) ) { $ plugins = PluginManager :: getInstance ( ) -> getPluginsLoadedAndActivated ( ) ; $ instances = ar... | Gets an instance of all available visit action and conversion dimension . |
24,381 | public function getModule ( ) { $ id = $ this -> getId ( ) ; if ( empty ( $ id ) ) { throw new Exception ( "Invalid dimension ID: '$id'." ) ; } $ parts = explode ( '.' , $ id ) ; return reset ( $ parts ) ; } | Returns the name of the plugin that contains this Dimension . |
24,382 | public function getType ( ) { if ( ! empty ( $ this -> type ) ) { return $ this -> type ; } if ( $ this -> getDbColumnJoin ( ) ) { return self :: TYPE_TEXT ; } if ( $ this -> getEnumColumnValues ( ) ) { return self :: TYPE_ENUM ; } if ( ! empty ( $ this -> columnType ) ) { $ type = strtolower ( $ this -> columnType ) ;... | Returns the type of the dimension which defines what kind of value this dimension stores . |
24,383 | public function run ( ) { $ tasks = $ this -> loader -> loadTasks ( ) ; $ this -> logger -> debug ( '{count} scheduled tasks loaded' , array ( 'count' => count ( $ tasks ) ) ) ; $ this -> timetable -> removeInactiveTasks ( $ tasks ) ; $ this -> logger -> info ( "Starting Scheduled tasks... " ) ; $ executionResults = ar... | Executes tasks that are scheduled to run then reschedules them . |
24,384 | public function runTaskNow ( $ taskName ) { $ tasks = $ this -> loader -> loadTasks ( ) ; foreach ( $ tasks as $ task ) { if ( $ task -> getName ( ) === $ taskName ) { return $ this -> executeTask ( $ task ) ; } } throw new \ InvalidArgumentException ( 'Task ' . $ taskName . ' not found' ) ; } | Run a specific task now . Will ignore the schedule completely . |
24,385 | public function getTaskList ( ) { $ tasks = $ this -> loader -> loadTasks ( ) ; return array_map ( function ( Task $ task ) { return $ task -> getName ( ) ; } , $ tasks ) ; } | Returns the list of the task names . |
24,386 | private function executeTask ( $ task ) { $ this -> logger -> info ( "Scheduler: executing task {taskName}..." , array ( 'taskName' => $ task -> getName ( ) , ) ) ; $ this -> isRunningTask = true ; $ timer = new Timer ( ) ; Piwik :: postEvent ( 'ScheduledTasks.execute' , array ( & $ task ) ) ; try { $ callable = array ... | Executes the given task |
24,387 | public function getPluginsBundledWithPiwik ( ) { $ pathGlobal = $ this -> settings -> getPathGlobal ( ) ; $ section = $ this -> settings -> getIniFileChain ( ) -> getFrom ( $ pathGlobal , 'Plugins' ) ; return $ section [ 'Plugins' ] ; } | Returns the list of plugins that are bundled with Piwik . |
24,388 | public function sortPlugins ( array $ plugins ) { $ global = $ this -> getPluginsBundledWithPiwik ( ) ; if ( empty ( $ global ) ) { return $ plugins ; } $ global = array_merge ( $ global , $ this -> corePluginsDisabledByDefault ) ; $ global = array_values ( $ global ) ; $ plugins = array_values ( $ plugins ) ; $ defaul... | Sorts an array of plugins in the order they should be loaded . We cannot use DI here as DI is not initialized at this stage . |
24,389 | public function sortPluginsAndRespectDependencies ( array $ plugins , $ pluginJsonCache = array ( ) ) { $ global = $ this -> getPluginsBundledWithPiwik ( ) ; if ( empty ( $ global ) ) { return $ plugins ; } $ global = array_merge ( $ global , $ this -> corePluginsDisabledByDefault ) ; $ global = array_values ( $ global... | Sorts an array of plugins in the order they should be saved in config . ini . php . This basically influences the order of the plugin config . php and which config will be loaded first . We want to make sure to require the config or a required plugin first before loading the plugin that requires it . |
24,390 | public function getAnnotationManager ( $ fetch = false , $ date = false , $ period = false , $ lastN = false ) { $ this -> checkSitePermission ( ) ; if ( $ date === false ) { $ date = Common :: getRequestVar ( 'date' , false ) ; } if ( $ period === false ) { $ period = Common :: getRequestVar ( 'period' , 'day' ) ; } i... | Controller action that returns HTML displaying annotations for a site and specific date range . |
24,391 | public function saveAnnotation ( ) { if ( $ _SERVER [ "REQUEST_METHOD" ] == "POST" ) { $ this -> checkTokenInUrl ( ) ; $ view = new View ( '@Annotations/saveAnnotation' ) ; $ view -> annotation = Request :: processRequest ( "Annotations.save" ) ; return $ view -> render ( ) ; } } | Controller action that modifies an annotation and returns HTML displaying the modified annotation . |
24,392 | public function addAnnotation ( ) { if ( $ _SERVER [ "REQUEST_METHOD" ] == "POST" ) { $ this -> checkTokenInUrl ( ) ; $ date = Common :: getRequestVar ( 'date' ) ; if ( strpos ( $ date , ',' ) !== false ) { $ date = reset ( explode ( ',' , $ date ) ) ; } Request :: processRequest ( "Annotations.add" , array ( 'date' =>... | Controller action that adds a new annotation for a site and returns new annotation manager HTML for the site and date range . |
24,393 | public function deleteAnnotation ( ) { if ( $ _SERVER [ "REQUEST_METHOD" ] == "POST" ) { $ this -> checkTokenInUrl ( ) ; Request :: processRequest ( "Annotations.delete" ) ; return $ this -> getAnnotationManager ( $ fetch = true ) ; } } | Controller action that deletes an annotation and returns new annotation manager HTML for the site & date range . |
24,394 | public function getEvolutionIcons ( ) { $ annotationCounts = Request :: processRequest ( "Annotations.getAnnotationCountForDates" , array ( 'getAnnotationText' => 1 ) ) ; $ view = new View ( '@Annotations/getEvolutionIcons' ) ; $ view -> annotationCounts = reset ( $ annotationCounts ) ; return $ view -> render ( ) ; } | Controller action that echo s HTML that displays marker icons for an evolution graph s x - axis . The marker icons still need to be positioned by the JavaScript . |
24,395 | public function getAllSites ( ) { $ db = $ this -> getDb ( ) ; $ sites = $ db -> fetchAll ( "SELECT * FROM " . $ this -> table . " ORDER BY idsite ASC" ) ; return $ sites ; } | Returns all websites |
24,396 | public function getSitesWithVisits ( $ time , $ now ) { $ sites = Db :: fetchAll ( " SELECT idsite FROM " . $ this -> table . " s WHERE EXISTS ( SELECT 1 FROM " . Common :: prefixTable ( 'log_visit' ) . " v WHERE v.idsite = s.idsite AND v... | Returns the list of the website IDs that received some visits since the specified timestamp . |
24,397 | public function getSitesFromIds ( $ idSites , $ limit = false ) { if ( count ( $ idSites ) === 0 ) { return array ( ) ; } if ( $ limit ) { $ limit = "LIMIT " . ( int ) $ limit ; } else { $ limit = '' ; } $ idSites = array_map ( 'intval' , $ idSites ) ; $ db = $ this -> getDb ( ) ; $ sites = $ db -> fetchAll ( "SELECT *... | Returns the list of websites from the ID array in parameters . |
24,398 | public function getSitesId ( ) { $ result = Db :: fetchAll ( "SELECT idsite FROM " . Common :: prefixTable ( 'site' ) ) ; $ idSites = array ( ) ; foreach ( $ result as $ idSite ) { $ idSites [ ] = $ idSite [ 'idsite' ] ; } return $ idSites ; } | Returns the list of all the website IDs registered . Caller must check access . |
24,399 | public function getUniqueSiteTimezones ( ) { $ results = Db :: fetchAll ( "SELECT distinct timezone FROM " . $ this -> table ) ; $ timezones = array ( ) ; foreach ( $ results as $ result ) { $ timezones [ ] = $ result [ 'timezone' ] ; } return $ timezones ; } | Returns the list of unique timezones from all configured sites . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.